Documentation
¶
Overview ¶
package pdb has utilities for working with the Pebble database.
Index ¶
- func Compact(sp *pebble.Snapshot, ba *pebble.Batch, tableID TableID, ...) error
- func Exists(sp RO, k []byte, pred func([]byte) bool) (bool, error)
- func IncrUint32(ba *pebble.Batch, key []byte, delta int32, deleteZero bool) (uint32, error)
- func IncrUint64(ba *pebble.Batch, key []byte, delta int64) (uint64, error)
- func PrefixUpperBound(prefix []byte) []byte
- func TableDelete(ba WO, tid TableID, key []byte) error
- func TableLowerBound(tableID TableID) []byte
- func TablePut(ba WO, tid TableID, key []byte, value []byte) error
- func TableUpperBound(tableID TableID) []byte
- func Undo(sp RO, ba WO, tid TableID, prefix []byte, mvid MVTag) error
- type MVKey
- type MVRow
- type MVSet
- type MVTag
- type RO
- type TKey
- type TableID
- type WO
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compact ¶
func Compact(sp *pebble.Snapshot, ba *pebble.Batch, tableID TableID, exclude func(MVTag) bool) error
Compact iterates over the snapshot, and write delete to Batch to compact a table with Multi-Version keys. The snapshot should be from before the batch. There can be an arbitrary amount of time between the snapshot and the batch, and this algorithm will still be correct. This assumes that MVIDs are never reused.
func Exists ¶
Exists returns true if the key exists in the database, who's value satisfies a predicate. If pred is nil, it is ignored.
func IncrUint32 ¶
func IncrUint64 ¶
IncrUint64 looks for a 64 bit integer at key adds delta to it and saves it. If the key is not found that is equivalent to reading a 0. The new value is returned.
func PrefixUpperBound ¶
func TableLowerBound ¶
func TableUpperBound ¶
Types ¶
type MVRow ¶
MVRow is a multi-version row.
type RO ¶
type RO interface {
Get(k []byte) (v []byte, closer io.Closer, err error)
NewIter(opts *pebble.IterOptions) (*pebble.Iterator, error)
}
RO is a read-only interface for the Pebble database.
type WO ¶
type WO interface {
Set(k, v []byte, opts *pebble.WriteOptions) error
Delete(k []byte, opts *pebble.WriteOptions) error
}
WO is a write-only interface for the Pebble database.