queue

package
v0.0.0-...-b3e7a1a Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Error           = errors.NewClass("queue")
	NotFound        = Error.NewClass("not found", errors.NoCaptureStack())
	AlreadyEnqueued = Error.NewClass("already enqueued",
		errors.NoCaptureStack())
)

Functions

func CommonTestClear

func CommonTestClear(t *testing.T, queue_under_test Queue)

func CommonTestDequeueN

func CommonTestDequeueN(t *testing.T, queue_under_test Queue)

func CommonTestEnqueue

func CommonTestEnqueue(t *testing.T, queue_under_test Queue)

func CommonTestIter

func CommonTestIter(t *testing.T, queue_under_test Queue)

func CommonTestPosition

func CommonTestPosition(t *testing.T, queue_under_test Queue)

func CommonTestRemove

func CommonTestRemove(t *testing.T, queue_under_test Queue)

func CommonTestRemoveFirst

func CommonTestRemoveFirst(t *testing.T, queue_under_test Queue)

func CommonTestRemoveLast

func CommonTestRemoveLast(t *testing.T, queue_under_test Queue)

func CommonTestRemoveMiddle

func CommonTestRemoveMiddle(t *testing.T, queue_under_test Queue)

func CommonTestSize

func CommonTestSize(t *testing.T, queue_under_test Queue)

func GetPosition

func GetPosition(err error) (position int)

func SetPosition

func SetPosition(pos int) errors.ErrorOption

Types

type Queue

type Queue interface {
	Clear() error
	DequeueN(n int) ([][]byte, int, error)
	Enqueue(datum []byte) (int, error)
	Iter(fn func(index int, datum []byte) (stop bool)) error
	Position(datum []byte) (int, error)
	Remove(datum []byte) error
	Size() (int, error)
}

type TestQueue

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

func NewTestQueue

func NewTestQueue(q Queue) *TestQueue

func (*TestQueue) Clear

func (q *TestQueue) Clear() error

func (*TestQueue) DequeueN

func (q *TestQueue) DequeueN(n int) (
	taken []TestQueueable, num_left int, err error)

func (*TestQueue) Enqueue

func (q *TestQueue) Enqueue(datum *TestQueueable) (int, error)

func (*TestQueue) Iter

func (q *TestQueue) Iter(fn func(int, *TestQueueable) bool) error

func (*TestQueue) Position

func (q *TestQueue) Position(tq *TestQueueable) (int, error)

func (*TestQueue) Remove

func (q *TestQueue) Remove(tq *TestQueueable) error

func (*TestQueue) Size

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

type TestQueueable

type TestQueueable struct {
	Key_  string `json:"key"`
	Value string `json:"value"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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