boltdb

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: May 28, 2019 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Error is the default boltdb errs class

Functions

This section is empty.

Types

type Client

type Client struct {
	Path   string
	Bucket []byte
	// contains filtered or unexported fields
}

Client is the entrypoint into a bolt data store

func New

func New(path, bucket string) (*Client, error)

New instantiates a new BoltDB client given db file path, and a bucket name

func NewShared

func NewShared(path string, buckets ...string) ([]*Client, error)

NewShared instantiates a new BoltDB with multiple buckets

func (*Client) Close

func (client *Client) Close() error

Close closes a BoltDB client

func (*Client) Delete

func (client *Client) Delete(key storage.Key) error

Delete deletes a key/value pair from boltdb, for a given the key

func (*Client) Get

func (client *Client) Get(key storage.Key) (storage.Value, error)

Get looks up the provided key from boltdb returning either an error or the result.

func (*Client) GetAll

func (client *Client) GetAll(keys storage.Keys) (storage.Values, error)

GetAll finds all values for the provided keys (up to storage.LookupLimit). If more keys are provided than the maximum, an error will be returned.

func (*Client) Iterate

func (client *Client) Iterate(opts storage.IterateOptions, fn func(storage.Iterator) error) error

Iterate iterates over items based on opts

func (*Client) List

func (client *Client) List(first storage.Key, limit int) (storage.Keys, error)

List returns either a list of keys for which boltdb has values or an error.

func (*Client) Put

func (client *Client) Put(key storage.Key, value storage.Value) error

Put adds a key/value to boltDB in a batch, where boltDB commits the batch to to disk every 1000 operations or 10ms, whichever is first. The MaxBatchDelay are using default settings. Ref: https://github.com/boltdb/bolt/blob/master/db.go#L160 Note: when using this method, check if it need to be executed asynchronously since it blocks for the duration db.MaxBatchDelay.

func (*Client) PutAndCommit added in v0.11.0

func (client *Client) PutAndCommit(key storage.Key, value storage.Value) error

PutAndCommit adds a key/value to BoltDB and writes it to disk.

Jump to

Keyboard shortcuts

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