// New creates a new BigMap and populates its shards.
//
// The entrysize defines the maximum size of the items added.
// Smaller items are no problem, bigger will return an error.
//
// A config may be provided to tune the map as needed
// and/or enable expiration of items.
// See bigmap.Config
New creates a new BigMap and populates its shards.

The entrysize defines the maximum size of the items added.
Smaller items are no problem, bigger will return an error.

A config may be provided to tune the map as needed
and/or enable expiration of items.
See bigmap.Config
// New creates a new BigMap and populates its shards . // // The entrysize defines the maximum size of the items added . // Smaller items are no problem bigger will return an error . // // A config may be provided to tune the map as needed // and / or enable expiration of items . // See bigmap . Config
func New(entrysize uint64, config ...Config) BigMap {
	conf := Config{
		Shards:            DefaultShards,
		Capacity:          DefaultCapacity,
		ExpirationFactory: nil,
	}
	if len(config) != 0 {
		firstConf := config[0]
		if firstConf.Capacity != 0 {
			conf.Capacity = firstConf.Capacity
		}
		if firstConf.Shards != 0 {
			conf.Shards = firstConf.Shards
		}
		conf.ExpirationFactory = firstConf.ExpirationFactory
	}
	bm := BigMap{shards: make([]*Shard, conf.Shards)}
	for i := 0; i < conf.Shards; i++ {
		var expirationService ExpirationService = nil
		if conf.ExpirationFactory != nil {
			expirationService = conf.ExpirationFactory(i)
		}
		bm.shards[i] = NewShard(conf.Capacity, entrysize, expirationService)
	}
	return bm
}
func New ( entrysize uint64 , config ... Config ) BigMap { conf := Config { Shards : DefaultShards , Capacity : DefaultCapacity , ExpirationFactory : nil , } if len ( config ) != 0 { firstConf := config [ 0 ] if firstConf . Capacity != 0 { conf . Capacity = firstConf . Capacity } if firstConf . Shards != 0 { conf . Shards = firstConf . Shards } conf . ExpirationFactory = firstConf . ExpirationFactory } bm := BigMap { shards : make ( [ ] * Shard , conf . Shards ) } for i := 0 ; i < conf . Shards ; i ++ { var expirationService ExpirationService = nil if conf . ExpirationFactory != nil { expirationService = conf . ExpirationFactory ( i ) } bm . shards [ i ] = NewShard ( conf . Capacity , entrysize , expirationService ) } return bm }
New creates a new BigMap and populates its shards.
New creates a new BigMap and populates its shards .