Documentation
¶
Index ¶
- Variables
- func CreatePool(dataPath, metaPath string) error
- func DrainPool() error
- type BadgerBatch
- type BadgerItem
- type BadgerIterator
- type BadgerStore
- func (s *BadgerStore) Begin(writable bool) (Transaction, error)
- func (s *BadgerStore) Close() error
- func (s *BadgerStore) Delete(ctx context.Context, key []byte) error
- func (s *BadgerStore) Get(ctx context.Context, key []byte) ([]byte, error)
- func (s *BadgerStore) NewBatch() Batch
- func (s *BadgerStore) NewIterator(opts IteratorOptions) Iterator
- func (s *BadgerStore) PrefixScan(ctx context.Context, prefix []byte) (map[string][]byte, error)
- func (s *BadgerStore) Put(ctx context.Context, key, value []byte) error
- func (s *BadgerStore) Size() (int64, error)
- func (s *BadgerStore) Sync() error
- type BadgerTransaction
- func (t *BadgerTransaction) Begin(writable bool) (Transaction, error)
- func (t *BadgerTransaction) Close() error
- func (t *BadgerTransaction) Commit() error
- func (t *BadgerTransaction) Delete(ctx context.Context, key []byte) error
- func (t *BadgerTransaction) Discard()
- func (t *BadgerTransaction) Get(ctx context.Context, key []byte) ([]byte, error)
- func (t *BadgerTransaction) IterateHistory(ctx context.Context, key []byte) *badger.Iterator
- func (t *BadgerTransaction) IterateHistoryReverse(ctx context.Context, key []byte) *badger.Iterator
- func (t *BadgerTransaction) NewBatch() Batch
- func (t *BadgerTransaction) NewIterator(opts IteratorOptions) Iterator
- func (t *BadgerTransaction) PrefixScan(ctx context.Context, prefix []byte) (map[string][]byte, error)
- func (t *BadgerTransaction) Put(ctx context.Context, key, value []byte) error
- func (t *BadgerTransaction) Size() (int64, error)
- func (t *BadgerTransaction) Sync() error
- type BadgerTxnBatch
- type Batch
- type Item
- type Iterator
- type IteratorOptions
- type KeyNotFoundError
- type NestedTransactionError
- type Pool
- func (p *Pool) BackgroundMaintenance(ctx context.Context)
- func (p *Pool) Close() error
- func (p *Pool) DataStore() Store
- func (p *Pool) MetaStore() Store
- func (p *Pool) NewDataConnection(ctx context.Context, writable bool) (*StoreConnection, error)
- func (p *Pool) NewMetaConnection(ctx context.Context, writable bool) (*StoreConnection, error)
- func (p *Pool) Size() (dataSize, metaSize int64, err error)
- func (p *Pool) Sync() error
- type Store
- type StoreConnection
- type Transaction
Constants ¶
This section is empty.
Variables ¶
var ErrKeyNotFound = &KeyNotFoundError{}
ErrKeyNotFound is returned when a key doesn't exist
var ErrNestedTransaction = &NestedTransactionError{}
ErrNestedTransaction is returned when attempting to create nested transactions
Functions ¶
func CreatePool ¶
CreatePool initializes the global KV store pool
Types ¶
type BadgerBatch ¶
type BadgerBatch struct {
// contains filtered or unexported fields
}
BadgerBatch implements atomic batch operations
func (*BadgerBatch) Delete ¶
func (b *BadgerBatch) Delete(key []byte) error
func (*BadgerBatch) Flush ¶
func (b *BadgerBatch) Flush() error
func (*BadgerBatch) Reset ¶
func (b *BadgerBatch) Reset()
func (*BadgerBatch) Set ¶
func (b *BadgerBatch) Set(key, value []byte) error
type BadgerItem ¶
type BadgerItem struct {
// contains filtered or unexported fields
}
BadgerItem wraps BadgerDB item
func (*BadgerItem) Key ¶
func (i *BadgerItem) Key() []byte
func (*BadgerItem) KeyCopy ¶
func (i *BadgerItem) KeyCopy() []byte
func (*BadgerItem) Value ¶
func (i *BadgerItem) Value() ([]byte, error)
func (*BadgerItem) ValueCopy ¶
func (i *BadgerItem) ValueCopy() ([]byte, error)
type BadgerIterator ¶
type BadgerIterator struct {
// contains filtered or unexported fields
}
BadgerIterator wraps BadgerDB iterator
func (*BadgerIterator) Close ¶
func (i *BadgerIterator) Close() error
func (*BadgerIterator) Item ¶
func (i *BadgerIterator) Item() Item
func (*BadgerIterator) Next ¶
func (i *BadgerIterator) Next()
func (*BadgerIterator) Rewind ¶
func (i *BadgerIterator) Rewind()
func (*BadgerIterator) Seek ¶
func (i *BadgerIterator) Seek(key []byte)
func (*BadgerIterator) Valid ¶
func (i *BadgerIterator) Valid() bool
type BadgerStore ¶
type BadgerStore struct {
// contains filtered or unexported fields
}
BadgerStore implements Store interface using BadgerDB
func NewBadgerStore ¶
func NewBadgerStore(path string) (*BadgerStore, error)
NewBadgerStore creates a new BadgerDB-backed store
func (*BadgerStore) Begin ¶
func (s *BadgerStore) Begin(writable bool) (Transaction, error)
func (*BadgerStore) Close ¶
func (s *BadgerStore) Close() error
func (*BadgerStore) NewBatch ¶
func (s *BadgerStore) NewBatch() Batch
func (*BadgerStore) NewIterator ¶
func (s *BadgerStore) NewIterator(opts IteratorOptions) Iterator
func (*BadgerStore) PrefixScan ¶ added in v0.1.0
func (*BadgerStore) Size ¶
func (s *BadgerStore) Size() (int64, error)
func (*BadgerStore) Sync ¶
func (s *BadgerStore) Sync() error
type BadgerTransaction ¶
type BadgerTransaction struct {
// contains filtered or unexported fields
}
BadgerTransaction wraps BadgerDB transaction
func (*BadgerTransaction) Begin ¶
func (t *BadgerTransaction) Begin(writable bool) (Transaction, error)
func (*BadgerTransaction) Close ¶
func (t *BadgerTransaction) Close() error
func (*BadgerTransaction) Commit ¶
func (t *BadgerTransaction) Commit() error
func (*BadgerTransaction) Delete ¶
func (t *BadgerTransaction) Delete(ctx context.Context, key []byte) error
func (*BadgerTransaction) Discard ¶
func (t *BadgerTransaction) Discard()
func (*BadgerTransaction) IterateHistory ¶ added in v0.2.0
func (*BadgerTransaction) IterateHistoryReverse ¶ added in v0.2.0
func (*BadgerTransaction) NewBatch ¶
func (t *BadgerTransaction) NewBatch() Batch
func (*BadgerTransaction) NewIterator ¶
func (t *BadgerTransaction) NewIterator(opts IteratorOptions) Iterator
func (*BadgerTransaction) PrefixScan ¶ added in v0.1.0
func (*BadgerTransaction) Put ¶
func (t *BadgerTransaction) Put(ctx context.Context, key, value []byte) error
func (*BadgerTransaction) Size ¶
func (t *BadgerTransaction) Size() (int64, error)
func (*BadgerTransaction) Sync ¶
func (t *BadgerTransaction) Sync() error
type BadgerTxnBatch ¶
type BadgerTxnBatch struct {
// contains filtered or unexported fields
}
BadgerTxnBatch implements batch operations within a transaction
func (*BadgerTxnBatch) Delete ¶
func (b *BadgerTxnBatch) Delete(key []byte) error
func (*BadgerTxnBatch) Flush ¶
func (b *BadgerTxnBatch) Flush() error
func (*BadgerTxnBatch) Reset ¶
func (b *BadgerTxnBatch) Reset()
func (*BadgerTxnBatch) Set ¶
func (b *BadgerTxnBatch) Set(key, value []byte) error
type Batch ¶
type Batch interface {
Set(key, value []byte) error
Delete(key []byte) error
Flush() error
Reset()
}
Batch provides atomic batch operations
type Item ¶
type Item interface {
Key() []byte
KeyCopy() []byte
Value() ([]byte, error)
ValueCopy() ([]byte, error)
}
Item represents a key-value pair during iteration
type Iterator ¶
type Iterator interface {
io.Closer
// Navigation
Rewind()
Seek(key []byte)
Next()
Valid() bool
// Data access
Item() Item
}
Iterator provides ordered key-value iteration
type IteratorOptions ¶
IteratorOptions configures iteration behavior
type KeyNotFoundError ¶
type KeyNotFoundError struct{}
func (*KeyNotFoundError) Error ¶
func (e *KeyNotFoundError) Error() string
type NestedTransactionError ¶
type NestedTransactionError struct{}
func (*NestedTransactionError) Error ¶
func (e *NestedTransactionError) Error() string
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool manages multiple key-value store instances
func (*Pool) BackgroundMaintenance ¶
BackgroundMaintenance runs periodic maintenance tasks
func (*Pool) NewDataConnection ¶
NewDataConnection creates a connection to the data store
func (*Pool) NewMetaConnection ¶
NewMetaConnection creates a connection to the metadata store
type Store ¶
type Store interface {
// Basic operations
Get(ctx context.Context, key []byte) ([]byte, error)
Put(ctx context.Context, key, value []byte) error
Delete(ctx context.Context, key []byte) error
PrefixScan(ctx context.Context, prefix []byte) (map[string][]byte, error)
// Batch operations for atomic writes
NewBatch() Batch
// Iteration support for range queries
NewIterator(opts IteratorOptions) Iterator
// Transaction support
Begin(writable bool) (Transaction, error)
// Lifecycle
Close() error
// Statistics and maintenance
Size() (int64, error)
Sync() error
}
Store defines the key-value storage interface for Atlas-DB
type StoreConnection ¶
type StoreConnection struct {
// contains filtered or unexported fields
}
StoreConnection represents a connection to a specific store
func (*StoreConnection) Close ¶
func (c *StoreConnection) Close() error
Close discards the transaction (alias for Rollback)
func (*StoreConnection) Commit ¶
func (c *StoreConnection) Commit() error
Commit commits the transaction
func (*StoreConnection) Rollback ¶
func (c *StoreConnection) Rollback()
Rollback discards the transaction
func (*StoreConnection) Store ¶
func (c *StoreConnection) Store() Store
Store returns the underlying store
func (*StoreConnection) Transaction ¶
func (c *StoreConnection) Transaction() Transaction
Transaction returns the active transaction