queue

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2019 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Error = errs.Class("queue error")

Error is a standard error class for this package.

Functions

This section is empty.

Types

type Queue

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

Queue implements the RepairQueue interface

func NewQueue

func NewQueue(client storage.Queue) *Queue

NewQueue returns a pointer to a new Queue instance with an initialized connection to Redis

func (*Queue) Dequeue

func (q *Queue) Dequeue(ctx context.Context) (pb.InjuredSegment, error)

Dequeue returns the next repair segement and removes it from the queue

func (*Queue) Enqueue

func (q *Queue) Enqueue(ctx context.Context, qi *pb.InjuredSegment) error

Enqueue adds a repair segment to the queue

func (*Queue) Peekqueue

func (q *Queue) Peekqueue(ctx context.Context, limit int) ([]pb.InjuredSegment, error)

Peekqueue returns upto 'limit' of the entries from the repair queue

type RepairQueue

type RepairQueue interface {
	// Enqueue adds an injured segment.
	Enqueue(ctx context.Context, qi *pb.InjuredSegment) error
	// Dequeue removes an injured segment.
	Dequeue(ctx context.Context) (pb.InjuredSegment, error)
	// Peekqueue lists limit amount of injured segments.
	Peekqueue(ctx context.Context, limit int) ([]pb.InjuredSegment, error)
}

RepairQueue implements queueing for segments that need repairing.

Jump to

Keyboard shortcuts

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