Documentation
¶
Index ¶
- func NewNodes(cfg config.Config) (ms map[string]Manager, err error)
- func NewNodesFromConfig(filepath string) (map[string]Manager, error)
- type Manager
- func New(nt Type, name string) (Manager, error)
- func NewConsistent(name string) (Manager, error)
- func NewDirect(name string) (Manager, error)
- func NewRadmon(name string) (Manager, error)
- func NewRoundRobin(name string) (Manager, error)
- func NewWithNodes(nt Type, name string, nodes []*Node) (Manager, error)
- type Node
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Manager ¶
type Manager interface {
// adds a node to the node ring.
Add(node *Node)
// get the node responsible for the data key.
NodeFor(keys ...string) (*Node, bool)
// removes all nodes from the node ring.
Remove()
// removes a node from the node ring.
RemoveByID(id string)
// print all nodes
PrintNodes()
// is the node ring empty
IsEmpty() bool
}
Manager node manager functions defines.
func NewConsistent ¶
NewConsistent get consistent node manager
func NewRoundRobin ¶
NewRoundRobin get roundrobin node manager
type Node ¶
type Node struct {
// for recognize node with input id
ID string `yaml:"id" json:"id"`
// node's probability weight, roundrobin does not support
Weight uint32 `yaml:"weight" json:"weight"`
// node's value
Value string `yaml:"value" json:"value"`
// kvs for meta data
Metadata config.Options `yaml:"options" json:"options"`
// contains filtered or unexported fields
}
Node params for a node
Click to show internal directories.
Click to hide internal directories.