Documentation ¶
Overview ¶
Package boltkv provides an implementation of the gRPC service KV using boltdb as a backend.
Index ¶
Constants ¶
const DefaultBoltBucketName = "kv"
DefaultBoltBucketName is the default bucket name used for the underlying boltdb for BoltKV.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoltKV ¶
BoltKV represents a boltdb connection and implements the KVServer interface, allowing it to be used by the KV gRPC service.
func NewBoltKV ¶
func NewBoltKV(path string, options ...BoltKVOption) (_ *BoltKV, err error)
NewBoltKV takes the path and any functional options, and constructs a new BoltKV.
func (*BoltKV) Delete ¶
Delete takes the provided DeleteRequest, containing a key to lookup, and deletes the key/value from the underlying boltdb storage. This will not check if a key is set before attempting to delete.
func (*BoltKV) Get ¶
func (b *BoltKV) Get(ctx context.Context, req *kvpb.GetRequest) (*kvpb.GetResponse, error)
Get takes the provided GetRequest, containing a key to lookup, and returns the key and value from the underlying boltdb storage. If the key is not set, an error is returned.
type BoltKVOption ¶
type BoltKVOption func(*BoltKV)
BoltKVOption represents the function signature for any BoltKV functional options.
func WithBucketName ¶
func WithBucketName(bucket string) BoltKVOption
WithBucketName is a functional option for specifying a boltdb bucket name other than the default.