store

package
v0.0.71 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2019 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrKeyNotFound is an error indicating a given key does not exist
	ErrKeyNotFound = errors.New("not found")
	// ErrQueueNotFound is an error indicating a given queue does not exist
	ErrQueueNotFound = errors.New("queue not found")
	// ErrIndexOutdated is an error indicating that the supplied index is outdated
	ErrIndexOutdated = errors.New("index outdated")
)

Functions

This section is empty.

Types

type BatchInput added in v0.0.71

type BatchInput struct {
	ID     string
	Offset uint64
	Data   [][]byte
}

type BatchOutput added in v0.0.71

type BatchOutput struct {
	ID     string
	Offset uint64
	Count  int
	Err    error
}

type BoltStore

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

func New

func New(options Options) (*BoltStore, error)

func (*BoltStore) AckInflight added in v0.0.71

func (b *BoltStore) AckInflight(id string, index uint64) error

func (*BoltStore) All added in v0.0.70

func (b *BoltStore) All() []string

func (*BoltStore) Close

func (b *BoltStore) Close() error

Close is used to gracefully close the DB connection.

func (*BoltStore) CreateQueue

func (b *BoltStore) CreateQueue(id string) error

func (*BoltStore) Delete added in v0.0.71

func (b *BoltStore) Delete(id string, index uint64) error

func (*BoltStore) DeleteQueue

func (b *BoltStore) DeleteQueue(id string) error

func (*BoltStore) Exists added in v0.0.71

func (b *BoltStore) Exists(id string) bool

func (*BoltStore) GetExpiredInflights added in v0.0.71

func (b *BoltStore) GetExpiredInflights(currentTime time.Time) []*pb.ExpiredInflights

func (*BoltStore) GetRange

func (b *BoltStore) GetRange(id string, from uint64, buff []StoredMessage) (int, uint64, error)

func (*BoltStore) GetStatistics added in v0.0.71

func (b *BoltStore) GetStatistics(id string) (*pb.QueueStatistics, error)

func (*BoltStore) ListQueues added in v0.0.71

func (b *BoltStore) ListQueues() ([]string, error)

func (*BoltStore) On added in v0.0.71

func (b *BoltStore) On(queue string, event string, f func(payload interface{})) (cancel func())

func (*BoltStore) Put

func (b *BoltStore) Put(id string, index uint64, payload []byte) error

func (*BoltStore) PutBatch added in v0.0.71

func (b *BoltStore) PutBatch(batches []*pb.QueueStateTransitionMessagePut) error

func (*BoltStore) Restore added in v0.0.71

func (b *BoltStore) Restore(r io.Reader) error

func (*BoltStore) SetInflight added in v0.0.71

func (b *BoltStore) SetInflight(id string, index uint64, deadline uint64) error

func (*BoltStore) TickExpiredMessages added in v0.0.71

func (b *BoltStore) TickExpiredMessages(messages []*pb.ExpiredInflights) error

func (*BoltStore) WriteTo added in v0.0.71

func (b *BoltStore) WriteTo(out io.Writer) error

type Options

type Options struct {
	// Path is the file path to the BoltDB to use
	Path string

	// BoltOptions contains any specific BoltDB options you might
	// want to specify [e.g. open timeout]
	BoltOptions *bolt.Options

	// NoSync causes the database to skip fsync calls after each
	// write to the log. This is unsafe, so it should be used
	// with caution.
	NoSync bool
}

type Store added in v0.0.71

type Store interface {
	DeleteQueue(id string) error
	CreateQueue(id string) error
	Put(id string, index uint64, payload []byte) error
	GetRange(id string, from uint64, buff [][]byte) (uint64, int, error)
	All() []string
}

type StoredMessage added in v0.0.71

type StoredMessage struct {
	Offset  uint64
	Payload []byte
}

Jump to

Keyboard shortcuts

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