roundrobin

package
v0.0.0-...-84d53aa Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2019 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RoundRobin

type RoundRobin struct {
	sync.Mutex
	// contains filtered or unexported fields
}

RoundRobin manages item in round-robin order.

func New

func New() *RoundRobin

New creates RoundRobin.

func (*RoundRobin) Exclude

func (rr *RoundRobin) Exclude(key string)

Exclude adds a item in exclude list or swaps a item from include list. Items in exclude list are excluded and can't be fetched.

func (*RoundRobin) HasNext

func (rr *RoundRobin) HasNext() bool

HasNext returns true if next item exists.

func (*RoundRobin) Include

func (rr *RoundRobin) Include(key string)

Include adds a item in include list or swaps a item from exclude list. Only items in include list can't be fetched in round-robin order.

func (*RoundRobin) Next

func (rr *RoundRobin) Next() string

Next returns next item in round-robin order.

func (*RoundRobin) Remove

func (rr *RoundRobin) Remove(key string)

Remove removes a item.

func (*RoundRobin) Reset

func (rr *RoundRobin) Reset()

Reset appends items in exclude list to include list and resets exclude list.

Jump to

Keyboard shortcuts

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