Documentation ¶
Overview ¶
Package boltdb contains the BoltDB store implementation.
Index ¶
- Variables
- func New(endpoints []string, options *store.Config) (store.Store, error)
- func Register()
- type BoltDB
- func (b *BoltDB) AtomicDelete(_ context.Context, key string, previous *store.KVPair) (bool, error)
- func (b *BoltDB) AtomicPut(_ context.Context, key string, value []byte, previous *store.KVPair, ...) (bool, *store.KVPair, error)
- func (b *BoltDB) Close() error
- func (b *BoltDB) Delete(_ context.Context, key string) error
- func (b *BoltDB) DeleteTree(_ context.Context, keyPrefix string) error
- func (b *BoltDB) Exists(_ context.Context, key string, _ *store.ReadOptions) (bool, error)
- func (b *BoltDB) Get(_ context.Context, key string, _ *store.ReadOptions) (*store.KVPair, error)
- func (b *BoltDB) List(_ context.Context, keyPrefix string, _ *store.ReadOptions) ([]*store.KVPair, error)
- func (b *BoltDB) NewLock(_ context.Context, _ string, _ *store.LockOptions) (store.Locker, error)
- func (b *BoltDB) Put(_ context.Context, key string, value []byte, _ *store.WriteOptions) error
- func (b *BoltDB) Watch(_ context.Context, _ string, _ <-chan struct{}, _ *store.ReadOptions) (<-chan *store.KVPair, error)
- func (b *BoltDB) WatchTree(_ context.Context, _ string, _ <-chan struct{}, _ *store.ReadOptions) (<-chan []*store.KVPair, error)
Constants ¶
This section is empty.
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 boltBucket config option is missing. ErrBoltBucketOptionMissing = errors.New("boltBucket config option missing") )
Functions ¶
Types ¶
type BoltDB ¶
type BoltDB struct { // By default, valkeyrie 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 // contains filtered or unexported fields }
BoltDB type implements the Store interface.
func (*BoltDB) AtomicDelete ¶
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 ¶
func (b *BoltDB) AtomicPut(_ context.Context, key string, value []byte, previous *store.KVPair, _ *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) DeleteTree ¶
DeleteTree deletes a range of keys with a given prefix.
func (*BoltDB) Get ¶
Get the value at "key". BoltDB doesn't provide an inbuilt last modified index with every kv pair. It's implemented by an atomic counter maintained by the valkeyrie and appended to the value passed by the client.
func (*BoltDB) List ¶
func (b *BoltDB) List(_ context.Context, keyPrefix string, _ *store.ReadOptions) ([]*store.KVPair, error)
List returns the range of keys starting with the passed in prefix.
func (*BoltDB) NewLock ¶
NewLock has to implemented at the library level since it's not supported by BoltDB.