storage

package
v0.0.0-...-50e0b1d Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrKeyNotFound error
	ErrKeyNotFound = errors.New("key not found")
)

Functions

func CopyBytes

func CopyBytes(b []byte) (c []byte)

func SnappyDecode

func SnappyDecode(block []byte) (value []byte, err error)

func SnappyEncode

func SnappyEncode(value []byte) (block []byte)

Types

type Entry

type Entry struct {
	Key, Value []byte
}

Entry key value

type Store

type Store interface {
	// Close the current Store
	Close() (err error)
	// Remove the current Store
	Remove() (err error)
	// RunGC garbage collect the undelying DB
	RunGC() (err error)
	// NewTxn creates a rw/ro transaction
	NewTxn(update bool) (txn Txn)
}

Store interface

type Txn

type Txn interface {
	// Discard this transaction
	Discard()
	// Commit this transaction
	Commit() (err error)
	// Get value for the given key
	Get(key []byte) (value []byte, err error)
	// GetTree for the given prefix
	GetTree(prefix []byte) (entries []Entry, err error)
	// Set value for the given key
	Set(key, value []byte) (err error)
	// SetWithTTL value for the given key
	SetWithTTL(key, value []byte, ttl time.Duration) (err error)
	// Delete the given key
	Delete(key []byte) (err error)
	// DeleteTree for the given prefix
	DeleteTree(prefix []byte) (err error)
}

Txn interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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