libkv: github.com/docker/libkv/store/boltdb Index | Files

package boltdb

import "github.com/docker/libkv/store/boltdb"

Index

Package Files

boltdb.go

Variables

var (
    // ErrMultipleEndpointsUnsupported is thrown when multiple endpoints specified for
    // BoltDB. Endpoint has to be a local file path
    ErrMultipleEndpointsUnsupported = errors.New("boltdb supports one endpoint and should be a file path")
    // ErrBoltBucketOptionMissing is thrown when boltBcuket config option is missing
    ErrBoltBucketOptionMissing = errors.New("boltBucket config option missing")
)

func New Uses

func New(endpoints []string, options *store.Config) (store.Store, error)

New opens a new BoltDB connection to the specified path and bucket

func Register Uses

func Register()

Register registers boltdb to libkv

type BoltDB Uses

type BoltDB struct {

    // By default libkv opens and closes the bolt DB connection  for every
    // get/put operation. This allows multiple apps to use a Bolt DB at the
    // same time.
    // PersistConnection flag provides an option to override ths behavior.
    // ie: open the connection in New and use it till Close is called.
    PersistConnection bool
    sync.Mutex
    // contains filtered or unexported fields
}

BoltDB type implements the Store interface

func (*BoltDB) AtomicDelete Uses

func (b *BoltDB) AtomicDelete(key string, previous *store.KVPair) (bool, error)

AtomicDelete deletes a value at "key" if the key has not been modified in the meantime, throws an error if this is the case

func (*BoltDB) AtomicPut Uses

func (b *BoltDB) AtomicPut(key string, value []byte, previous *store.KVPair, options *store.WriteOptions) (bool, *store.KVPair, error)

AtomicPut puts a value at "key" if the key has not been modified since the last Put, throws an error if this is the case

func (*BoltDB) Close Uses

func (b *BoltDB) Close()

Close the db connection to the BoltDB

func (*BoltDB) Delete Uses

func (b *BoltDB) Delete(key string) error

Delete the value for the given key.

func (*BoltDB) DeleteTree Uses

func (b *BoltDB) DeleteTree(keyPrefix string) error

DeleteTree deletes a range of keys with a given prefix

func (*BoltDB) Exists Uses

func (b *BoltDB) Exists(key string) (bool, error)

Exists checks if the key exists inside the store

func (*BoltDB) Get Uses

func (b *BoltDB) Get(key string) (*store.KVPair, error)

Get the value at "key". BoltDB doesn't provide an inbuilt last modified index with every kv pair. Its implemented by by a atomic counter maintained by the libkv and appened to the value passed by the client.

func (*BoltDB) List Uses

func (b *BoltDB) List(keyPrefix string) ([]*store.KVPair, error)

List returns the range of keys starting with the passed in prefix

func (*BoltDB) NewLock Uses

func (b *BoltDB) NewLock(key string, options *store.LockOptions) (store.Locker, error)

NewLock has to implemented at the library level since its not supported by BoltDB

func (*BoltDB) Put Uses

func (b *BoltDB) Put(key string, value []byte, opts *store.WriteOptions) error

Put the key, value pair. index number metadata is prepended to the value

func (*BoltDB) Watch Uses

func (b *BoltDB) Watch(key string, stopCh <-chan struct{}) (<-chan *store.KVPair, error)

Watch has to implemented at the library level since its not supported by BoltDB

func (*BoltDB) WatchTree Uses

func (b *BoltDB) WatchTree(directory string, stopCh <-chan struct{}) (<-chan []*store.KVPair, error)

WatchTree has to implemented at the library level since its not supported by BoltDB

Package boltdb imports 11 packages (graph) and is imported by 90 packages. Updated 2018-09-18. Refresh now. Tools for package owners.