Documentation ¶
Overview ¶
Package node provides node selector for liaison.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNoAvailableNode will be returned if no node is available. ErrNoAvailableNode = errors.New("selector: no available node") )
Functions ¶
This section is empty.
Types ¶
type Selector ¶
type Selector interface { AddNode(node *databasev1.Node) RemoveNode(node *databasev1.Node) Pick(group, name string, shardID uint32) (string, error) run.PreRunner fmt.Stringer }
Selector keeps all data nodes in the memory and can provide different algorithm to pick an available node.
func NewMaglevSelector ¶
func NewMaglevSelector() Selector
NewMaglevSelector creates a new backend selector based on Maglev hashing algorithm.
func NewPickFirstSelector ¶
NewPickFirstSelector returns a simple selector that always returns the first node if exists.
func NewRoundRobinSelector ¶ added in v0.7.0
NewRoundRobinSelector creates a new round-robin selector.
Click to show internal directories.
Click to hide internal directories.