Documentation ¶
Index ¶
- type BBoltCursor
- func (bbc *BBoltCursor) BucketID() string
- func (bbc *BBoltCursor) Context() context.Context
- func (bbc *BBoltCursor) First() (key string, value []byte, valid bool)
- func (bbc *BBoltCursor) Last() (key string, value []byte, valid bool)
- func (bbc *BBoltCursor) Next() (key string, value []byte, valid bool)
- func (bbc *BBoltCursor) NextN(steps uint) (docs map[string][]byte, itemsRemaining bool)
- func (bbc *BBoltCursor) Prev() (key string, value []byte, valid bool)
- func (bbc *BBoltCursor) PrevN(steps uint) (docs map[string][]byte, itemsRemaining bool)
- func (bbc *BBoltCursor) Release()
- func (bbc *BBoltCursor) Seek(searchKey string) (key string, value []byte, valid bool)
- type BoltBucket
- func (bb *BoltBucket) Close() (err error)
- func (bb *BoltBucket) Cursor(ctx context.Context) (cursor buckets.IBucketCursor, err error)
- func (bb *BoltBucket) Delete(key string) (err error)
- func (bb *BoltBucket) Get(key string) (val []byte, err error)
- func (bb *BoltBucket) GetMultiple(keys []string) (docs map[string][]byte, err error)
- func (bb *BoltBucket) ID() string
- func (bb *BoltBucket) Info() (info *buckets.BucketStoreInfo)
- func (bb *BoltBucket) Set(key string, value []byte) (err error)
- func (bb *BoltBucket) SetMultiple(docs map[string][]byte) (err error)
- type BoltStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BBoltCursor ¶
type BBoltCursor struct {
// contains filtered or unexported fields
}
BBoltCursor is a wrapper around the bbolt cursor to map to the IBucketCursor API and to ensure its transaction is released after the cursor is no longer used. This implements the IBucketCursor API
func NewBBoltCursor ¶
func (*BBoltCursor) BucketID ¶
func (bbc *BBoltCursor) BucketID() string
func (*BBoltCursor) Context ¶
func (bbc *BBoltCursor) Context() context.Context
Context returns the cursor application context
func (*BBoltCursor) First ¶
func (bbc *BBoltCursor) First() (key string, value []byte, valid bool)
First moves the cursor to the first item
func (*BBoltCursor) Last ¶
func (bbc *BBoltCursor) Last() (key string, value []byte, valid bool)
Last moves the cursor to the last item
func (*BBoltCursor) Next ¶
func (bbc *BBoltCursor) Next() (key string, value []byte, valid bool)
Next iterates to the next key from the current cursor
func (*BBoltCursor) NextN ¶
func (bbc *BBoltCursor) NextN(steps uint) (docs map[string][]byte, itemsRemaining bool)
NextN increases the cursor position N times and return the encountered key-value pairs
func (*BBoltCursor) Prev ¶
func (bbc *BBoltCursor) Prev() (key string, value []byte, valid bool)
Prev iterations to the previous key from the current cursor
func (*BBoltCursor) PrevN ¶
func (bbc *BBoltCursor) PrevN(steps uint) (docs map[string][]byte, itemsRemaining bool)
PrevN decreases the cursor position N times and return the encountered key-value pairs
func (*BBoltCursor) Release ¶
func (bbc *BBoltCursor) Release()
Release the cursor This ends the bbolt bbBucket transaction
type BoltBucket ¶
type BoltBucket struct {
// contains filtered or unexported fields
}
BoltBucket implements the IBucket API using the embedded bolt database This bbBucket differs from bolt buckets in that transactions are created for read/write operations. This means that bbolt buckets are created and released continuously as needed.
func NewBoltBucket ¶
func NewBoltBucket(clientID, bucketID string, db *bbolt.DB, onRelease func(bucket buckets.IBucket)) *BoltBucket
NewBoltBucket creates a new bbBucket
clientID that owns the bbBucket. Used for logging bucketID used to create transactional buckets db bbolt database used to create transactions onRelease callback to track reference for detecting unreleased buckets on close
func (*BoltBucket) Cursor ¶
func (bb *BoltBucket) Cursor(ctx context.Context) (cursor buckets.IBucketCursor, err error)
Cursor returns a new cursor for iterating the bbBucket. This creates a read-only bbolt bbBucket for iteration. The cursor MUST be closed after use to release the bbolt bbBucket. Do not write to the database while iterating.
ctx is the application context available throught the cursor Context() method
This returns a cursor with Next() and Prev() iterators or an error if the bbBucket doesn't exist
func (*BoltBucket) Delete ¶
func (bb *BoltBucket) Delete(key string) (err error)
Delete a key in the bbBucket
func (*BoltBucket) Get ¶
func (bb *BoltBucket) Get(key string) (val []byte, err error)
Get reads a document with the given key returns nil if the key doesn't exist
func (*BoltBucket) GetMultiple ¶
func (bb *BoltBucket) GetMultiple(keys []string) (docs map[string][]byte, err error)
GetMultiple returns a batch of documents with existing keys
func (*BoltBucket) Info ¶
func (bb *BoltBucket) Info() (info *buckets.BucketStoreInfo)
Info returns the bbBucket info
func (*BoltBucket) Set ¶
func (bb *BoltBucket) Set(key string, value []byte) (err error)
Set writes a document with the given key
func (*BoltBucket) SetMultiple ¶
func (bb *BoltBucket) SetMultiple(docs map[string][]byte) (err error)
SetMultiple writes a multiple documents in a single transaction This returns an error as soon as an invalid key is encountered. Cancel this bbBucket with Close(false) if this returns an error.
type BoltStore ¶
type BoltStore struct {
// contains filtered or unexported fields
}
func NewBoltStore ¶
NewBoltStore creates a bbBucket store supporting the IBucketStore API using the embedded BBolt database
storePath is the file holding the database
func (*BoltStore) Close ¶
Close the store and flush changes to disk Since boltDB locks transactions on close, this runs in the background. Close() returns before closing is completed.