github.com/git-amp/amp-sdk-go@v0.7.5/stdlib/symbol/memory_table/api.memory.go (about)

     1  package memory_table
     2  
     3  import "github.com/git-amp/amp-sdk-go/stdlib/symbol"
     4  
     5  // CreateTable creates a new memory-based symbol.Table intended to handle extreme loading.
     6  //
     7  // Value allocations are pooled, so TableOpts.PoolSz of 16k means thousands of small value entries could be stored within a single allocation.
     8  func (opts TableOpts) CreateTable() (symbol.Table, error) {
     9  	return createTable(opts)
    10  }
    11  
    12  type TableOpts struct {
    13  	symbol.Issuer             // How this table will issue new IDs.  If nil, this table's db will be used as the Issuer
    14  	IssuerInitsAt   symbol.ID // The floor ID to start issuing from if initializing a new Issuer.
    15  	WorkingSizeHint int       // anticipated number of entries in working set
    16  	PoolSz          int32     // Value backing buffer allocation pool sz
    17  }
    18  
    19  // DefaultOpts is a suggested set of options.
    20  func DefaultOpts() TableOpts {
    21  	return TableOpts{
    22  		IssuerInitsAt:   symbol.DefaultIssuerMin,
    23  		WorkingSizeHint: 600,
    24  		PoolSz:          16 * 1024,
    25  	}
    26  }