Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrDuplicateShards returned when shard set is empty ErrDuplicateShards = errors.New("duplicate shards") // ErrInvalidShardID is returned on an invalid shard ID ErrInvalidShardID = errors.New("no shard with given ID") )
Functions ¶
Types ¶
type HashFn ¶
HashFn is a sharding hash function
func DefaultHashFn ¶
DefaultHashFn generates a HashFn based on murmur32
type HashGen ¶
HashGen generates HashFn based on the length of shards
func NewHashGenWithSeed ¶
NewHashGenWithSeed generates a HashFnGen based on murmur32 with a given seed
type ShardSet ¶
type ShardSet interface { // All returns a slice to the shards in this set All() []shard.Shard // AllIDs returns a slice to the shard IDs in this set AllIDs() []uint32 // Lookup will return a shard for a given identifier Lookup(id ident.ID) uint32 // LookupStateByID returns the state of the shard with a given ID LookupStateByID(shardID uint32) (shard.State, error) // Min returns the smallest shard owned by this shard set Min() uint32 // Max returns the largest shard owned by this shard set Max() uint32 // HashFn returns the sharding hash function HashFn() HashFn }
ShardSet contains a sharding function and a set of shards, this interface allows for potentially out of order shard sets
func NewEmptyShardSet ¶
NewEmptyShardSet creates a new sharding scheme with an empty set of shards
Click to show internal directories.
Click to hide internal directories.