Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHashed ¶
func NewHashed(shards uint32, factory StorageFactoryFunc) *hashShard
New shard pool based on default hash distribution IEEE CRC-32. See HashedCustom for details.
Example ¶
pool := NewHashed(3, func(shardID uint32) (storages.Storage, error) { return nil, errors.New("TODO: any storage implementation") }) shardedStorage := storages.Sharded(pool) defer shardedStorage.Close() // do something
Output:
func NewHashedArray ¶
New pool based on default hash distribution and fixed number of pre-allocated shards
func NewHashedCustom ¶
func NewHashedCustom(shards uint32, factory StorageFactoryFunc, hashFunc HashShardFunc) *hashShard
New shard pool based on custom hash distribution. Shards will be open dynamically on-demand and kept open till pool closed. Thread safe.
Types ¶
type HashShardFunc ¶
Hash function of key to determinate shard id. Non-scaled
Click to show internal directories.
Click to hide internal directories.