balance

package
v0.0.0-...-f1b2c4c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Balancer

type Balancer interface {
	Add(nodes ...Node) error
	Delete(nodes ...Node) error
	GetNode(v []byte) (Node, bool)
}

type ConsistentHash

type ConsistentHash struct {
	// contains filtered or unexported fields
}

func NewConsistentHash

func NewConsistentHash(rep int, hashFunc func([]byte) uint32) *ConsistentHash

func (*ConsistentHash) Add

func (ch *ConsistentHash) Add(nodes ...Node) (err error)

func (*ConsistentHash) Delete

func (ch *ConsistentHash) Delete(nodes ...Node) (err error)

func (*ConsistentHash) GetNode

func (ch *ConsistentHash) GetNode(pkg []byte) (res Node, ok bool)

func (*ConsistentHash) Show

func (ch *ConsistentHash) Show()

type Node

type Node interface {
	String() string
}

type NormalBalancer

type NormalBalancer struct {
	// contains filtered or unexported fields
}

func NewNormalBalancer

func NewNormalBalancer() *NormalBalancer

func (*NormalBalancer) Add

func (nb *NormalBalancer) Add(nodes ...Node) (err error)

func (*NormalBalancer) Delete

func (nb *NormalBalancer) Delete(nodes ...Node) (err error)

func (*NormalBalancer) GetNode

func (nb *NormalBalancer) GetNode(bs []byte) (res Node, ok bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL