Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsKeyNotFound ¶
Types ¶
type Engine ¶
type Engine interface {
// Name engine name
Name() string
// Txn read-write transaction
Txn(fn func(KVTxn) error) error
// View read-only transaction
View(fn func(KVTxn) error) error
// Update read-write transaction
Update(fn func(KVTxn) error) error
// Snapshot return a mvcc snapshot
Snapshot() (Snapshot, error)
// Close engine
Close() error
}
Engine support txn
type KVTxn ¶
type KVTxn interface {
Get(key []byte) ([]byte, error)
Gets(keys ...[]byte) ([][]byte, error)
Set(key, value []byte) error
Delete(key []byte) error
Deletes(keys ...[]byte) error
Incr(key []byte, value uint64) (uint64, error)
Append(key, value []byte) ([]byte, error)
Exist(key []byte) (bool, error)
Add(key, value []byte) error
Merge(key []byte, fn MergeFunc) ([]byte, error)
ScanRange(begin, end []byte) (map[string][]byte, error)
ScanKeys(prefix []byte, limit int) ([][]byte, error)
ScanValues(prefix []byte, limit int) (map[string][]byte, error)
}
KVTxn for store
type MergeFunc ¶
MergeFunc accepts two byte slices, one representing an existing value, and another representing a new value that needs to be ‘merged’ into it. MergeFunc contains the logic to perform the ‘merge’ and return an updated value. MergeFunc could perform operations like integer addition, list appends etc. Note that the ordering of the operands is maintained.
Click to show internal directories.
Click to hide internal directories.