backlog

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoMoreObjects is returned on Pop() when there are no more objects
	// to return
	ErrNoMoreObjects = errors.New("no more objects")
	// ErrAlreadyExists is returned on Push() when combination of object/key
	// already exists
	ErrAlreadyExists = errors.New("already exists")
)

Functions

This section is empty.

Types

type AckFunc

type AckFunc func()

AckFunc allows the handler of a popped object to acknowledge it has been handled and thus can be removed from the backlog.

type Backlog

type Backlog interface {
	Push(*object.Object, ...*crypto.PublicKey) error
	Pop(*crypto.PublicKey) (*object.Object, AckFunc, error)
}

Backlog keeps track of objects than need to be sent to each recipient.

func NewBolt

func NewBolt(st *storm.DB) (Backlog, error)

NewBolt constructs a new boltdb backed backlog, given a storm instance.

type Bolt

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

Bolt is a BoltDB backed Backlog

func (*Bolt) Pop

func (bl *Bolt) Pop(k *crypto.PublicKey) (*object.Object, AckFunc, error)

Pop an object from the backlog for a specific recipient

func (*Bolt) Push

func (bl *Bolt) Push(o *object.Object, ks ...*crypto.PublicKey) error

Push an object to the backlog with one or more recipients

Jump to

Keyboard shortcuts

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