smmoth_weight_rb

package module
v0.0.0-...-0e3cebe Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DuplicateNodeError = errors.New("duplicate node")

Functions

This section is empty.

Types

type Node

type Node struct {
	Host          string
	Weight        int
	CurrentWeight int
	Meta          map[string]string //other info that you want to store
}

func NewNode

func NewNode(name string, weight int, meta map[string]string) *Node

type WeightRoundRobin

type WeightRoundRobin struct {
	Nodes []*Node
	// contains filtered or unexported fields
}

func NewWeightRoundRobin

func NewWeightRoundRobin() *WeightRoundRobin

func (*WeightRoundRobin) AddNode

func (r *WeightRoundRobin) AddNode(node *Node)

func (*WeightRoundRobin) Next

func (r *WeightRoundRobin) Next() *Node

func (*WeightRoundRobin) Print

func (r *WeightRoundRobin) Print()

type WeightRoundRobinWithRing

type WeightRoundRobinWithRing struct {
	Nodes []*Node
	// contains filtered or unexported fields
}

func NewWeightRoundRobinWithRing

func NewWeightRoundRobinWithRing() *WeightRoundRobinWithRing

func (*WeightRoundRobinWithRing) AddNode

func (r *WeightRoundRobinWithRing) AddNode(node *Node) error

func (*WeightRoundRobinWithRing) DelNode

func (r *WeightRoundRobinWithRing) DelNode(node *Node)

func (*WeightRoundRobinWithRing) DelNodeByName

func (r *WeightRoundRobinWithRing) DelNodeByName(name string)

func (*WeightRoundRobinWithRing) Next

func (r *WeightRoundRobinWithRing) Next() *Node

func (*WeightRoundRobinWithRing) Print

func (r *WeightRoundRobinWithRing) Print()

type WeightRoundRobinWithRing2

type WeightRoundRobinWithRing2 struct {
	Nodes []*Node
	// contains filtered or unexported fields
}

func NewWeightRoundRobinWithRing2

func NewWeightRoundRobinWithRing2() *WeightRoundRobinWithRing2

func (*WeightRoundRobinWithRing2) AddNode

func (r *WeightRoundRobinWithRing2) AddNode(node *Node) error

func (*WeightRoundRobinWithRing2) DelNode

func (r *WeightRoundRobinWithRing2) DelNode(node *Node)

func (*WeightRoundRobinWithRing2) Next

func (r *WeightRoundRobinWithRing2) Next() *Node

func (*WeightRoundRobinWithRing2) Print

func (r *WeightRoundRobinWithRing2) Print()

Jump to

Keyboard shortcuts

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