Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type CHash ¶
type CHash interface { // AddMembers adds one or more members to the cluster // May return ErrInvalidCapacity if member capacity less or equal 0 // May return ErrMemberExists if member was added before AddMembers(members ...Member) error // RemoveMembers removes members with given ids RemoveMembers(memberIds ...string) error // Reconfigure replaces all members list Reconfigure(members []Member) error // GetMembers returns list of members for given key // Members count will be equal replication factor or total members count (if it is less than the replication factor) GetMembers(key string) []Member // GetPartition returns partition number for given key GetPartition(key string) int // GetPartitionMembers return members by partition number GetPartitionMembers(partId int) ([]Member, error) // Distribute members by partitions // Must be called if you changed members' capacity Distribute() // PartitionCount returns configured partitions count PartitionCount() int }
type Config ¶
type Config struct { // Hasher implementation (optional), by default, will be used xxhash Hasher Hasher // PartitionCount - how many virtual partitions will be distributed by nodes, reasonable values from 100 to 10k PartitionCount uint64 // ReplicationFactor - how many nodes expected for GetMembers ReplicationFactor int // Multiply Factor (optional) - this value multiplied for member capacity means how many times a member will be added to the hash ring. The default value is 2000. MultiplyFactor int }
Click to show internal directories.
Click to hide internal directories.