kv

package
v0.0.0-...-75aef46 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2019 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

type Batch interface {
	Putter

	Len() int
	Write() error
}

Batch defines batch of putting ops.

type GetPutCloser

type GetPutCloser interface {
	GetPutter
	Close() error
}

GetPutCloser with close method.

type GetPutter

type GetPutter interface {
	Getter
	Putter
}

GetPutter wraps methods for getting/putting kvs.

type Getter

type Getter interface {
	// Get value for given key.
	// An error returned if key not found. It can be checked via IsNotFound.
	Get(key []byte) (value []byte, err error)
	Has(key []byte) (bool, error)
	IsNotFound(error) bool

	NewIterator(r Range) Iterator
}

Getter wraps methods for getting kvs.

type Iterator

type Iterator interface {
	Next() bool
	Release()
	Error() error

	Key() []byte
	Value() []byte
}

Iterator to iterates kvs.

type Putter

type Putter interface {
	Put(key, value []byte) error
	Delete(key []byte) error

	NewBatch() Batch
}

Putter wraps methods for putting kvs.

type Range

type Range struct {
	From []byte
	To   []byte
}

Range describes key range of kv store.

func NewRange

func NewRange(from []byte, to []byte) *Range

NewRange create a range.

func NewRangeWithBytesPrefix

func NewRangeWithBytesPrefix(prefix []byte) *Range

NewRangeWithBytesPrefix create a range defined by bytes prefix.

func NewRangeWithHexPrefix

func NewRangeWithHexPrefix(hexPrefix string) (*Range, error)

NewRangeWithHexPrefix create a range defined by hex prefix. The hex can be odd.

func (Range) WithPrefix

func (r Range) WithPrefix(prefix []byte) *Range

WithPrefix create a new range prefixed with prefix.

Jump to

Keyboard shortcuts

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