Documentation ¶
Overview ¶
Package consistent borrows ideas from "stathat.com/c/consistent" simplify it for performance, no concurrence guarantee any more!
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrEmptyCircle is the error returned when trying to get an element when nothing has been added to hash. ErrEmptyCircle = errors.New("empty circle") // ErrNotSorted is the error returned when trying to get an element when the consistent circle is not sorted. ErrNotSorted = errors.New("not sorted") )
Functions ¶
This section is empty.
Types ¶
type Consistent ¶
type Consistent struct {
// contains filtered or unexported fields
}
Consistent holds the information about the members of the consistent hash circle.
func (*Consistent) Add ¶
func (c *Consistent) Add(elt string, numOfReplicas int)
Add inserts a string element in the consistent hash numOfReplicas times.
Click to show internal directories.
Click to hide internal directories.