Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrKeyNotFound is returned when key isn't found on a txn.Get. ErrKeyNotFound = errors.New("Key not found") )
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB interface {
// NewTransactionAt follows the same logic as DB.NewTransaction(), but uses the
// provided read timestamp.
//
// This is only useful for databases built on top of Badger (like Dgraph), and
// can be ignored by most users.
NewTransactionAt(readTs uint64, update bool) Txn
// SetDiscardTs sets a timestamp at or below which, any invalid or deleted
// versions can be discarded from the LSM tree, and thence from the value log to
// reclaim disk space. Can only be used with managed transactions.
SetDiscardTs(ts uint64)
Close() error
}
type Item ¶
type Item interface {
// KeyCopy returns a copy of the key of the item, writing it to dst slice.
// If nil is passed, or capacity of dst isn't sufficient, a new slice would be allocated and
// returned.
KeyCopy(dst []byte) []byte
// ValueCopy returns a copy of the value of the item from the value log, writing it to dst slice.
// If nil is passed, or capacity of dst isn't sufficient, a new slice would be allocated and
// returned. Tip: It might make sense to reuse the returned slice as dst argument for the next call.
//
// This function is useful in long running iterate/update transactions to avoid a write deadlock.
// See Github issue: https://github.com/dgraph-io/badger/issues/315
ValueCopy(dst []byte) ([]byte, error)
}
type Txn ¶
type Txn interface {
// CommitAt commits the transaction, following the same logic as Commit(), but
// at the given commit timestamp. This will panic if not used with managed transactions.
//
// This is only useful for databases built on top of Badger (like Dgraph), and
// can be ignored by most users.
CommitAt(commitTs uint64, callback func(error)) error
Discard()
Set([]byte, []byte) error
Delete([]byte) error
Get([]byte) (Item, error)
NewKeyIterator(key []byte, iterOpt adapter.IteratorOptions) Iterator
NewIterator(iterOpt adapter.IteratorOptions) Iterator
}
Click to show internal directories.
Click to hide internal directories.