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: 9 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")
	// ErrBucketNotFound is an error indicating the data store bucket does not exist
	ErrBucketNotFound = errors.New("bucket not found")
	// ErrTTLBucketNotFound is an error indicating the TTL index bucket does not exist
	ErrTTLBucketNotFound = errors.New("ttl bucket not found")
	// ErrMDBucketNotFound is an error indicating the metadata bucket does not exist
	ErrMDBucketNotFound = errors.New("metadata bucket not found")
	// ErrMDNotFound is an error indicating metadata for the given key does not exist
	ErrMDNotFound = errors.New("metadata 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 BoltStore

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

func New

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

func (*BoltStore) Close

func (b *BoltStore) Close() error

Close is used to gracefully close the DB connection.

func (*BoltStore) Delete

func (b *BoltStore) Delete(key []byte, version uint64) error

func (*BoltStore) DeleteBatch

func (b *BoltStore) DeleteBatch(keys []*pb.KVMetadata) error

func (*BoltStore) Get

func (b *BoltStore) Get(key []byte) ([]byte, error)

func (*BoltStore) GetMetadata

func (b *BoltStore) GetMetadata(key []byte) (*pb.KVMetadata, error)

func (*BoltStore) GetWithMetadata

func (b *BoltStore) GetWithMetadata(key []byte) ([]byte, *pb.KVMetadata, error)

func (*BoltStore) ListExpiredKeys

func (b *BoltStore) ListExpiredKeys(from uint64, until uint64) ([]*pb.KVMetadata, error)

func (*BoltStore) ListKeys

func (b *BoltStore) ListKeys(prefix []byte) ([]*pb.KVMetadata, error)

func (*BoltStore) Put

func (b *BoltStore) Put(key []byte, value []byte, deadline uint64, version uint64) error

func (*BoltStore) Restore

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

func (*BoltStore) WriteTo

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
}

Jump to

Keyboard shortcuts

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