flushqueues

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExclusiveQueues

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

func New

func New(queues int, metric prometheus.Gauge) *ExclusiveQueues

New creates a new set of flush queues with a prom gauge to track current depth

func (*ExclusiveQueues) Clear

func (f *ExclusiveQueues) Clear(op Op)

Clear unblocks the requested op. This should be called only after a flush has been successful

func (*ExclusiveQueues) Dequeue

func (f *ExclusiveQueues) Dequeue(q int) Op

Dequeue removes the next op from the requested queue. After dequeueing the calling

process either needs to call ClearKey or Requeue

func (*ExclusiveQueues) Enqueue

func (f *ExclusiveQueues) Enqueue(op Op) error

Enqueue adds the op to the next queue and prevents any other items to be added with this key

func (*ExclusiveQueues) IsEmpty added in v0.7.0

func (f *ExclusiveQueues) IsEmpty() bool

func (*ExclusiveQueues) IsStopped added in v0.7.0

func (f *ExclusiveQueues) IsStopped() bool

func (*ExclusiveQueues) Requeue

func (f *ExclusiveQueues) Requeue(op Op) error

Requeue adds an op that is presumed to already be covered by activeKeys

func (*ExclusiveQueues) Stop

func (f *ExclusiveQueues) Stop()

Stop closes all queues

type Op added in v0.7.0

type Op interface {
	Key() string
	Priority() int64 // The larger the number the higher the priority.
}

Op is an operation on the priority queue.

type PriorityQueue added in v0.7.0

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

PriorityQueue is a priority queue.

func NewPriorityQueue added in v0.7.0

func NewPriorityQueue(lengthGauge prometheus.Gauge) *PriorityQueue

NewPriorityQueue makes a new priority queue.

func (*PriorityQueue) Close added in v0.7.0

func (pq *PriorityQueue) Close()

Close signals that the queue should be closed when it is empty. A closed queue will not accept new items.

func (*PriorityQueue) Dequeue added in v0.7.0

func (pq *PriorityQueue) Dequeue() Op

Dequeue will return the op with the highest priority; block if queue is empty; returns nil if queue is closed.

func (*PriorityQueue) DiscardAndClose added in v0.7.0

func (pq *PriorityQueue) DiscardAndClose()

DiscardAndClose closes the queue and removes all the items from it.

func (*PriorityQueue) Enqueue added in v0.7.0

func (pq *PriorityQueue) Enqueue(op Op) (bool, error)

Enqueue adds an operation to the queue in priority order. Returns true if added; false if the operation was already on the queue.

func (*PriorityQueue) Length added in v0.7.0

func (pq *PriorityQueue) Length() int

Length returns the length of the queue.

Jump to

Keyboard shortcuts

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