balancing

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PolicyKindFirstReady = "FirstReady"
	PolicyKindRandom     = "Random"
	PolicyKindRoundRobin = "RoundRobin"
)
View Source
const (
	LevelKindConnection = "Connection"
	LevelKindEndpoint   = "Endpoint"
	LevelKindLocation   = "Location"
)

Variables

View Source
var (
	ErrConnectionCreate = errors.New("connection create failed")
	ErrNodeClosed       = errors.New("node is closed")
)
View Source
var (
	ErrLevelsEmpty               = errors.New("empty levels")
	ErrPathLen                   = errors.New("path length is not equal to levels length")
	ErrPathExists                = errors.New("full path exists")
	ErrPathDoesNotExist          = errors.New("path does not exist")
	ErrConnectionConfigMisplaced = errors.New("connection config must be provided only for connection level")
)
View Source
var ErrPolicyUnknown = errors.New("unknown balancing policy")

Functions

This section is empty.

Types

type ConnectionConfig

type ConnectionConfig[PT connection[T], T any] struct {
	ConnFunc   connFunc[PT, T]
	ConnNumber int
}

type Level

type Level struct {
	Kind   string
	Policy string
}

func (Level) IsConnection

func (l Level) IsConnection() bool

type Path

type Path[PT connection[T], T any] struct {
	IDs []string

	ConnectionConfig[PT, T]
}

type Tree

type Tree[PT connection[T], T any] struct {
	// contains filtered or unexported fields
}

func NewTree

func NewTree[PT connection[T], T any](cfg TreeConfig[PT, T]) (*Tree[PT, T], error)

func (*Tree[PT, T]) AddPath

func (t *Tree[PT, T]) AddPath(path Path[PT, T]) error

func (*Tree[PT, T]) DeletePath

func (t *Tree[PT, T]) DeletePath(path Path[PT, T]) error

func (*Tree[PT, T]) GetConn

func (t *Tree[PT, T]) GetConn() PT

type TreeConfig

type TreeConfig[PT connection[T], T any] struct {
	Levels           []Level
	ConnectionConfig *ConnectionConfig[PT, T]
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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