Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotFound is returned when a key is not found in the storage. ErrNotFound = errors.New("key not found") // ErrObsolete is returned when a write operation is performed on a key that // already has a newer version. ErrObsolete = errors.New("obsolete write") // ErrNoMoreItems is returned when there are no more items in the iterator. ErrNoMoreItems = errors.New("no more items in the iterator") )
Functions ¶
func ToProtoValues ¶
func ToProtoValues(values []Value) []*proto.VersionedValue
Types ¶
type Engine ¶
Engine is the interface that wraps the basic storage operations. It is implemented by different storage engines, such as LSM-tree or in-memory storage, and can be easily swapped out. Not all storage engines may support all operations, so the interface is intentionally small. Note that in case of concurrent versions, the storage engine will return all versions of the key, and it is up to the caller to decide which one to use.
type ScanIterator ¶
ScanIterator is the interface for iterating over the key-value pairs in the storage, in lexicographical order. It is not usually safe for concurrent use, so we must create a new iterator for each goroutine.
type Scannable ¶
type Scannable interface {
Scan(key string) ScanIterator
}
Scannable is a storage that supports range scans. It may be supported by some storage engines, but not all of them. In case of concurrent versions, the storage engine will return all versions of the key, and it is up to the caller to decide which one to use.
type Value ¶
Value represents a single value associated with a key.
func AppendVersion ¶
AppendVersion appends a new version to the list of versions. In case the new version overtakes the existing ones, the older existing versions are discarded. If the new version is older than the existing ones, an ErrObsolete is returned. In case of concurrent versions, the new version is added to the list.