lb

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2022 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 2 more Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hash

type Hash func(data []byte) uint32

Hash func significant.

type LB

type LB struct{}

LB load balance object.

func NewLB

func NewLB() LB

NewLB return new load balance object.

func (*LB) RR

func (l *LB) RR() *RR

RR returns rr algorithm.

func (*LB) Shuffle

func (l *LB) Shuffle() *Shuffle

Shuffle returns shuffle algorithm.

type Map

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

Map hash map struct.

func New

func New(replicas int, fn Hash) *Map

New returns a new hash map.

func (*Map) Add

func (m *Map) Add(keys ...string)

Add add keys to consistent hash map.

func (*Map) Get

func (m *Map) Get(key string) string

Get returns hash node if key is exist.

type RR

type RR struct{}

RR round-robin.

func (*RR) SwitchTo

func (r *RR) SwitchTo(indexSize int) (int, error)

SwitchTo choose next.

type Shuffle

type Shuffle struct {
}

Shuffle object.

func (*Shuffle) SwitchTo

func (s *Shuffle) SwitchTo(indexSize int) (int, error)

SwitchTo returns next.

Jump to

Keyboard shortcuts

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