roundrobin

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyInstance = errors.New("empty round-robin instance")

ErrEmptyInstance denotes that there is nothing in the round-robin instance to schedule.

Functions

This section is empty.

Types

type RoundRobin

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

RoundRobin implements quite simple round-robin scheduling algorithm to distribute load fairly between servers.

func New

func New(items []string) *RoundRobin

New returns a new RoundRobin instance.

func (*RoundRobin) Add

func (r *RoundRobin) Add(item string)

Add adds a new item to the Round-Robin scheduler.

func (*RoundRobin) Delete

func (r *RoundRobin) Delete(item string)

Delete deletes an item from the Round-Robin scheduler.

func (*RoundRobin) Get

func (r *RoundRobin) Get() (string, error)

Get returns an item.

func (*RoundRobin) Length

func (r *RoundRobin) Length() int

Length returns the count of items

Jump to

Keyboard shortcuts

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