volumequeue

package
v2.0.0-...-8c19597 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: Apache-2.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 VolumeQueue

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

VolumeQueue manages the exponential backoff of retrying volumes. it behaves somewhat like a priority queue. however, the key difference is that volumes which are ready to process or reprocess are read off of an unbuffered channel, meaning the order in which ready volumes are processed is at the mercy of the golang scheduler. in practice, this does not matter.

func NewVolumeQueue

func NewVolumeQueue() *VolumeQueue

NewVolumeQueue returns a new VolumeQueue with the default timerSource.

func (*VolumeQueue) Enqueue

func (vq *VolumeQueue) Enqueue(id string, attempt uint)

Enqueue adds an entry to the VolumeQueue with the specified retry attempt. if an entry for the specified id already exists, enqueue will remove it and create a new entry.

func (*VolumeQueue) Outstanding

func (vq *VolumeQueue) Outstanding() int

Outstanding returns the number of items outstanding in this queue

func (*VolumeQueue) Stop

func (vq *VolumeQueue) Stop()

Stop stops the volumeQueue and cancels all outstanding entries. stop may only be called once.

func (*VolumeQueue) Wait

func (vq *VolumeQueue) Wait() (string, uint)

Wait returns the ID and attempt number of the next Volume ready to process. If no volume is ready, wait blocks until one is ready. if the volumeQueue is stopped, wait returns "", 0

Jump to

Keyboard shortcuts

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