storage

package
v0.0.0-...-40e4417 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2017 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBatchClosed common error for batch closed
	ErrBatchClosed = errors.New("storage batch closed")
)

Functions

func KeyInRange

func KeyInRange(key, start, end []byte) bool

KeyInRange check if key in the range [start, end)

func PrefixEnd

func PrefixEnd(prefix []byte) []byte

PrefixEnd key upper bound for the prefix

Types

type Batch

type Batch interface {
	Put(key, val []byte) error
	Del(key []byte) error

	Commit() error
	Close() error
}

Batch batch interface

type Iterator

type Iterator interface {
	First()
	Last()
	Seek(seek []byte)
	Next() bool
	Prev() bool
	Key() []byte
	Value() []byte
	Valid() bool

	Close() error
	Err() error
}

Iterator iter interface

type Storage

type Storage interface {
	// if key not found, just return nil value
	Get(key []byte) ([]byte, error)

	// if any key not found, just return nil value
	MGet(keys ...[]byte) ([][]byte, error)

	Put(key, val []byte) error
	Del(key []byte) error

	PrefixIterator(prefix []byte) (Iterator, error)
	RangeIterator(start, end []byte) (Iterator, error)

	Batch() (Batch, error)

	Close() error
	GC() error
}

Storage storage interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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