Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Balancer ¶
type Balancer[T uint32 | string] interface { // Next returns next one. Next() T // Put puts one into balancer. Put(T) // Delete deletes one from balancer. Delete(T) // GetAll returns all nodes. GetAll() []T // Len returns the length of nodes. Len() int }
Balancer is the interface for balancer.
type RoundRobin ¶
type RoundRobin[T uint32 | string] struct { sync.RWMutex // contains filtered or unexported fields }
RoundRobin is a balancer that selects nodes in a round-robin fashion.
func NewRoundRobin ¶
func NewRoundRobin[T uint32 | string]() *RoundRobin[T]
NewRoundRobin creates a balancer that selects nodes in a round-robin fashion.
func (*RoundRobin[T]) Delete ¶
func (r *RoundRobin[T]) Delete(node T)
Delete deletes one from balancer.
Click to show internal directories.
Click to hide internal directories.