store

package
v0.0.0-...-7be7ecd Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2015 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EmulatedMergeSingle

func EmulatedMergeSingle(writer KVWriter, mo MergeOperator, key []byte, operand []byte) error

EmulatedMergeSingle removes some duplicated code across KV stores which do not support merge operations on their own. It is up to the caller to ensure that an appropriate lock has been acquired in order for this behavior to be valid

Types

type EmulatedBatch

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

func NewEmulatedBatch

func NewEmulatedBatch(w KVWriter, mo MergeOperator) *EmulatedBatch

func (*EmulatedBatch) Close

func (b *EmulatedBatch) Close() error

func (*EmulatedBatch) Delete

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

func (*EmulatedBatch) Execute

func (b *EmulatedBatch) Execute() error

func (*EmulatedBatch) Merge

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

func (*EmulatedBatch) Set

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

type EmulatedMerge

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

func NewEmulatedMerge

func NewEmulatedMerge(mo MergeOperator) *EmulatedMerge

func (*EmulatedMerge) Execute

func (m *EmulatedMerge) Execute(w KVWriter) error

func (*EmulatedMerge) ExecuteDeferred

func (m *EmulatedMerge) ExecuteDeferred(w KVWriter) ([]*op, error)

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)
	Execute() error
	Close() error
}

type KVIterator

type KVIterator interface {
	SeekFirst()
	Seek([]byte)
	Next()

	Current() ([]byte, []byte, bool)
	Key() []byte
	Value() []byte
	Valid() bool

	Close() error
}

type KVReader

type KVReader interface {
	BytesSafeAfterClose() bool
	Get(key []byte) ([]byte, error)
	Iterator(key []byte) KVIterator
	Close() error
}

type KVStore

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

type KVWriter

type KVWriter interface {
	KVReader
	Set(key, val []byte) error
	Delete(key []byte) error
	NewBatch() KVBatch
}

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
}

Directories

Path Synopsis
Package cznicb provides an in-memory implementation of the KVStore interfaces using the cznic/b in-memory btree.
Package cznicb provides an in-memory implementation of the KVStore interfaces using the cznic/b in-memory btree.
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