queue

package
v0.0.0-...-b178995 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package queue implements a basic FIFO queues.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Queue

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

Queue is a FIFO queue,

func New

func New(path string) (*Queue, error)

New creates a new database.

func (*Queue) Blobs

func (q *Queue) Blobs() ([]*blob.Blob, error)

func (*Queue) Close

func (q *Queue) Close() error

Close the underlying db file.

func (*Queue) Dequeue

func (q *Queue) Dequeue(item interface{}) (bool, func(bool), error)

Dequeue the older item, unserialize the given item. Returns false if the queue is empty.

func (*Queue) Enqueue

func (q *Queue) Enqueue(item interface{}) (*id.ID, error)

Enqueue the given `item`. Must be JSON serializable.

func (*Queue) InstantDequeue

func (q *Queue) InstantDequeue(id *id.ID) error

InstantDequeue remove the given ID from the queue directly

func (*Queue) Remove

func (q *Queue) Remove() error

Remove the underlying db file.

func (*Queue) RemoveBlobs

func (q *Queue) RemoveBlobs(blobs []string) error

func (*Queue) Size

func (q *Queue) Size() (int, error)

Size returns the number of items currently enqueued

Jump to

Keyboard shortcuts

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