Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Represents how many virtual nodes are replicated on the hash ring in default. DefaultReplicas = 128 // To convert items and keys into index. DefaultHashFunc = crc32.ChecksumIEEE )
Functions ¶
func WithHashFunc ¶
WithHashFunc return a function to set the hashFunc of the consistent hash circle.
func WithReplicas ¶
func WithReplicas(r int) option
WithReplicas return a function to set the replicas of the consistent hash circle.
Types ¶
type Consistent ¶
Consistent holds the information about the members of the consistent hash circle.
func New ¶
func New(options ...option) *Consistent
New returns a consistent hash circle according to your ideas.
func (*Consistent) Add ¶
func (c *Consistent) Add(items ...string)
Add adds one or more items into the consistent hash circle.
func (*Consistent) Get ¶
func (c *Consistent) Get(key string) string
Get returns a item according to the key.
Click to show internal directories.
Click to hide internal directories.