storage

package
v0.0.0-...-6a013f7 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2018 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exists

func Exists(s Store, key []byte, bucket Bucket) (bool, error)

Exists returns true if the key exists in the provided bucket

func Read

func Read(s Store, key []byte, bucket Bucket) ([]byte, error)

Read is a convenience method to perform a single entry read.

func Write

func Write(s Store, key, value []byte, bucket Bucket) error

Write is a convenience method to perform a single entry write.

Types

type Bucket

type Bucket byte
const (
	TransactionBucket Bucket = 1
)

type Entry

type Entry struct {
	Bucket Bucket
	Key    []byte
	Value  []byte
}

func (*Entry) BucketKey

func (e *Entry) BucketKey() []byte

type Store

type Store interface {
	// WriteBatch writes a batch of entries to the DB.
	WriteBatch(batch []Entry) error

	// ReadBatch reads a batch of entries from the DB. Upon success, the bytes value for each entry should be set.
	ReadBatch(batch []*Entry) error

	// Close closes the store
	Close() error
}

func NewBoltStore

func NewBoltStore(path string) (Store, error)

Jump to

Keyboard shortcuts

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