Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoShardsAvailable = errors.New("no shards available")
View Source
var ErrShardAlreadyExists = errors.New("shard already exists")
Functions ¶
This section is empty.
Types ¶
type ShardStore ¶
type Sharder ¶
type Sharder[T any] struct { // Endpoints are a list of endpoints to generate shuffle shards from Endpoints []T // ReplicationFactor is the size of an individual shuffle shard ReplicationFactor int // ShardStore is a storage of all existing shuffle shards. // Sharder queries this store to ensure that a shuffle shard isn't allocated twice. // ShuffleShards are stored by a unique, deterministic key; a hash of the shard. ShardStore ShardStore // ShardKeyFunc is a function that receives a shuffle shard & returns a hash of its value. // It is used to lookup a shard for existence in the ShardStore. // It must not modify the received shuffle shard, instead make a deep copy of the parameter. ShardKeyFunc func([]T) (string, error) Rand *rand.Rand }
Click to show internal directories.
Click to hide internal directories.