kv

package module
v0.0.0-...-c4ad144 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 30, 2017 License: MIT Imports: 1 Imported by: 6

README

kv

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotRegistered = fmt.Errorf("not registered.")

Functions

func MultiGet

func MultiGet(kvreader KVReader, keys [][]byte) ([][]byte, error)

MultiGet is a helper function to retrieve mutiple keys from a KVReader, and might be used by KVStore implementations that don't have a native multi-get facility.

func Register

func Register(k interface{}, c Constructor)

Types

type ConfigType

type ConfigType map[string]interface{}

type Constructor

type Constructor func(...Option) (KVStore, error)

type EmulatedBatch

type EmulatedBatch struct {
	Ops    []*op
	Merger *EmulatedMerge
}

func NewEmulatedBatch

func NewEmulatedBatch(mo MergeOperator) *EmulatedBatch

func (*EmulatedBatch) Close

func (b *EmulatedBatch) Close() error

func (*EmulatedBatch) Delete

func (b *EmulatedBatch) Delete(key []byte)

func (*EmulatedBatch) Merge

func (b *EmulatedBatch) Merge(key, val []byte)

func (*EmulatedBatch) Reset

func (b *EmulatedBatch) Reset()

func (*EmulatedBatch) Set

func (b *EmulatedBatch) Set(key, val []byte)

type EmulatedMerge

type EmulatedMerge struct {
	Merges map[string][][]byte
	// contains filtered or unexported fields
}

func NewEmulatedMerge

func NewEmulatedMerge(mo MergeOperator) *EmulatedMerge

func (*EmulatedMerge) Merge

func (m *EmulatedMerge) Merge(key, val []byte)

type KVBatch

type KVBatch interface {
	Set(key, val []byte)
	Delete(key []byte)
	Merge(key, val []byte)
	Reset()
	Close() error
}

type KVBatchOptions

type KVBatchOptions struct {
	TotalBytes int
	NumSets    int
	NumDeletes int
	NumMerges  int
}

type KVIterator

type KVIterator interface {
	Seek(key []byte)
	Next()
	Key() []byte
	Value() []byte
	Valid() bool
	Current() ([]byte, []byte, bool)
	Close() error
	Reset()
	Reset0()
	Error() error
	Count() int
}

type KVReader

type KVReader interface {
	Get(key []byte) ([]byte, error)
	MultiGet(keys [][]byte) ([][]byte, error)
	PrefixIterator(prefix []byte) KVIterator
	PrefixIterator0(prefix []byte) KVIterator
	RangeIterator(start, end []byte) KVIterator
	RangeIterator0(start, end []byte) KVIterator

	ReversePrefixIterator(prefix []byte) KVIterator
	ReverseRangeIterator(start, end []byte) KVIterator
	Close() error
}

type KVRegistry

type KVRegistry struct {
	// contains filtered or unexported fields
}

func (KVRegistry) New

func (this KVRegistry) New(k interface{}, opts ...Option) (KVStore, error)

func (*KVRegistry) Register

func (this *KVRegistry) Register(k interface{}, c Constructor)

type KVStore

type KVStore interface {
	Writer() (KVWriter, error)
	Reader() (KVReader, error)
	Close() error
}

func New

func New(k interface{}, opts ...Option) (KVStore, error)

type KVWriter

type KVWriter interface {
	NewBatch() KVBatch
	NewBatchEx(KVBatchOptions) ([]byte, KVBatch, error)
	ExecuteBatch(batch KVBatch) error
	Close() error
}

type MergeOperator

type MergeOperator interface {

	// FullMerge the full sequence of operands on top of the existingValue
	// if no value currently exists, existingValue is nil
	// return the merged value, and success/failure
	FullMerge(key, existingValue []byte, operands [][]byte) ([]byte, bool)

	// Partially merge these two operands.
	// If partial merge cannot be done, return nil,false, which will defer
	// all processing until the FullMerge is done.
	PartialMerge(key, leftOperand, rightOperand []byte) ([]byte, bool)

	// Name returns an identifier for the operator
	Name() string
}

type OptConfig

type OptConfig struct{ ConfigType }

type OptFilePath

type OptFilePath struct{ FilePath string }

type OptMergeOperator

type OptMergeOperator struct{ MergeOperator }

type Option

type Option interface{}

type Setter

type Setter interface {
	Close()
	Flush()
	Set(k, v []byte)
}

func NewSetter

func NewSetter(kv KVStore) (setter Setter, err error)

Directories

Path Synopsis
Package gtreap provides an in-memory implementation of the KVStore interfaces using the gtreap balanced-binary treap, copy-on-write data structure.
Package gtreap provides an in-memory implementation of the KVStore interfaces using the gtreap balanced-binary treap, copy-on-write data structure.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL