Documentation ¶
Index ¶
- Variables
- func Bytesmask(fixedbits int) (fixedbytes int, mask byte)
- func GetOneWrapper(dat []byte, err error) ([]byte, error)
- func NewSplitCursor(c kv.Cursor, startkey []byte, matchBits int, ...) *splitCursor
- func Walk(c kv.Cursor, startkey []byte, fixedbits int, ...) error
- type BucketsMigrator
- type DBGetter
- type Database
- type DbWithPendingMutations
- type HasRwKV
- type HasTx
- type MinDatabase
- type TxFlags
Constants ¶
This section is empty.
Variables ¶
View Source
var EndSuffix = []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
View Source
var ErrKeyNotFound = errors.New("db: key not found")
ErrKeyNotFound is returned when key isn't found in the database.
Functions ¶
func NewSplitCursor ¶
Types ¶
type BucketsMigrator ¶
type DBGetter ¶
type DBGetter interface { kv.Getter // Get returns the value for a given key if it's present. Get(bucket string, key []byte) ([]byte, error) }
DBGetter wraps the database read operations.
type Database ¶
type Database interface { DBGetter kv.Putter kv.Deleter kv.Closer Begin(ctx context.Context, flags TxFlags) (DbWithPendingMutations, error) // starts db transaction Last(bucket string) ([]byte, []byte, error) IncrementSequence(bucket string, amount uint64) (uint64, error) ReadSequence(bucket string) (uint64, error) RwKV() kv.RwDB }
Database wraps all database operations. All methods are safe for concurrent use.
type DbWithPendingMutations ¶
type DbWithPendingMutations interface { Database // Commit - commits transaction (or flush data into underlying db object in case of `mutation`) // // Common pattern: // // tx := db.Begin() // defer tx.Rollback() // ... some calculations on `tx` // tx.Commit() // Commit() error Rollback() BatchSize() int }
DbWithPendingMutations is an extended version of the Database, where all changes are first made in memory. Later they can either be committed to the database or rolled back.
Click to show internal directories.
Click to hide internal directories.