queue

package
v0.33.1 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2025 License: Apache-2.0, MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Queue

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

Queue provides a FIFO interface to the datastore for storing cids.

CIDs in the process of being provided when a crash or shutdown occurs may be in the queue when the node is brought back online depending on whether they were fully written to the underlying datastore.

Input to the queue is buffered in memory. The contents of the buffer are written to the datastore when the input buffer contains batchSize items, or when idleWriteTime has elapsed since the previous batch write or dequeue. CIDs to dequeue are read, in order, from the input buffer if there are none in the datastore. Otherwise they are read from the datastore.

If queued items are read from the input buffer before it reaches its limit, then queued items can remain in memory. When the queue is closed, any remaining items in memory are written to the datastore.

func New added in v0.30.0

func New(ds datastore.Batching) *Queue

New creates a queue for cids.

func (*Queue) Clear added in v0.33.1

func (q *Queue) Clear() int

Clear clears all queued records from memory and the datastore. Returns the number of CIDs removed from the queue.

func (*Queue) Close

func (q *Queue) Close() error

Close stops the queue.

func (*Queue) Dequeue

func (q *Queue) Dequeue() <-chan cid.Cid

Dequeue returns a channel that for reading entries from the queue,

func (*Queue) Enqueue

func (q *Queue) Enqueue(c cid.Cid) (err error)

Enqueue puts a cid in the queue.

Jump to

Keyboard shortcuts

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