Documentation ¶
Index ¶
- Variables
- type BitCaskEngine
- type Engine
- type KeyValue
- type MVCC
- func (m *MVCC) Begin() (*MVCCTxn, error)
- func (m *MVCC) BeginAsOf(version MVCCVersion) (*MVCCTxn, error)
- func (m *MVCC) BeginReadOnly() (*MVCCTxn, error)
- func (m *MVCC) GetUnversioned(key []byte) ([]byte, error)
- func (m *MVCC) Resume(state *storagepb.MVCCTxnState) (*MVCCTxn, error)
- func (m *MVCC) SetUnversioned(key, value []byte) error
- func (m *MVCC) Status() (*storagepb.MVCCStatus, error)
- type MVCCTxn
- func (t *MVCCTxn) Commit() error
- func (t *MVCCTxn) Delete(key []byte) error
- func (t *MVCCTxn) Get(key []byte) ([]byte, error)
- func (t *MVCCTxn) ReadOnly() bool
- func (t *MVCCTxn) ReverseScan(start, end rangeutil.Bound) (itertools.Iterator[KeyValue], error)
- func (t *MVCCTxn) Rollback() error
- func (t *MVCCTxn) Scan(start, end rangeutil.Bound) (itertools.Iterator[KeyValue], error)
- func (t *MVCCTxn) Set(key, value []byte) error
- func (t *MVCCTxn) State() *storagepb.MVCCTxnState
- func (t *MVCCTxn) Version() MVCCVersion
- type MVCCVersion
- type Memory
- func (m *Memory) Close() error
- func (m *Memory) Delete(key []byte) error
- func (m *Memory) Flush() error
- func (m *Memory) Get(key []byte) ([]byte, error)
- func (m *Memory) ReverseScan(start, end rangeutil.Bound) (itertools.Iterator[KeyValue], error)
- func (b *Memory) ReverseScanPrefix(prefix []byte) (itertools.Iterator[KeyValue], error)
- func (m *Memory) Scan(start, end rangeutil.Bound) (itertools.Iterator[KeyValue], error)
- func (b *Memory) ScanPrefix(prefix []byte) (itertools.Iterator[KeyValue], error)
- func (m *Memory) Set(key, value []byte) error
- func (m *Memory) Status() (*storagepb.EngineStatus, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrReadOnly = errors.New("storage: read-only transcation") ErrSerializable = errors.New("storage: serialization failure, retry transcation") )
View Source
var ErrNotFound = errors.New("storage: not found")
ErrNotFound is returned when a key is not found in the engine.
Functions ¶
This section is empty.
Types ¶
type BitCaskEngine ¶
type BitCaskEngine struct { }
type Engine ¶
type Engine interface { // Get returns the value for the given key, or any error that occurred. // If the key does not exist, it returns ErrNotFound. Get(key []byte) ([]byte, error) // Set sets the value for the given key. Set(key, value []byte) error // Delete deletes the value for the given key. Deleting a non-existing key // is a no-op. Delete(key []byte) error // Flush flushes all the pending writes to the underlying storage medium. Flush() error // Scan returns an iterator that yields all key-value pairs with a key // that satisfies the given range bounds, in ascending order. Scan(start, end rangeutil.Bound) (itertools.Iterator[KeyValue], error) // ReverseScan returns an iterator that yields all key-value pairs with a // key that satisfies the given range bounds, in descending order. ReverseScan(start, end rangeutil.Bound) (itertools.Iterator[KeyValue], error) // ScanPrefix returns an iterator that yields all key-value pairs with a // key that has the given prefix, in ascending order. ScanPrefix(prefix []byte) (itertools.Iterator[KeyValue], error) // ReverseScanPrefix returns an iterator that yields all key-value pairs // with a key that has the given prefix, in descending order. ReverseScanPrefix(prefix []byte) (itertools.Iterator[KeyValue], error) // Status returns the current status of the engine. Status() (*storagepb.EngineStatus, error) // Close closes the engine. Close() error }
Engine is a key/value storage engine, where both keys and values are arbitrary byte string between 0 B and 2 GB, stored in lexicographical key order. Writes are only guaranteed durable after calling Flush().
This interface is designed to be used by a single goroutine, and implementations are not required to be thread-safe.
type KeyValue ¶
KeyValue represents a key-value pair.
func MakeKeyValue ¶
MakeKeyValue creates a KeyValue from the given key and value.
type MVCC ¶
type MVCC struct {
// contains filtered or unexported fields
}
func (*MVCC) BeginReadOnly ¶
func (*MVCC) SetUnversioned ¶
type MVCCTxn ¶
type MVCCTxn struct {
// contains filtered or unexported fields
}
func (*MVCCTxn) ReverseScan ¶
func (*MVCCTxn) State ¶
func (t *MVCCTxn) State() *storagepb.MVCCTxnState
func (*MVCCTxn) Version ¶
func (t *MVCCTxn) Version() MVCCVersion
type MVCCVersion ¶
type MVCCVersion = uint64
type Memory ¶
type Memory struct {
// contains filtered or unexported fields
}
func (*Memory) ReverseScan ¶
func (*Memory) ReverseScanPrefix ¶
func (*Memory) ScanPrefix ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.