kv_store

package
v0.0.0-...-2ee7648 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStoreError    = errors.New("LevelDB error")
	ErrStoreGetError = errors.New("LevelDB error during Get operation")
	ErrNotFound      = errors.New("LevelDB: item not found")
	ErrStorePutError = errors.New("LevelDB error during Put operation")
	ErrStoreDelError = errors.New("LevelDB error during Delete operation")
)

Functions

This section is empty.

Types

type Command

type Command struct {
	Table     string
	Key       Key
	Value     Value
	ClientID  ids.ID
	CommandID ids.CommandID
	Operation Operation
}

func (Command) Equal

func (c Command) Equal(a Command) bool

Equal returns true if two commands are equal

func (Command) IsRead

func (c Command) IsRead() bool

IsRead returns true if command is read

func (Command) String

func (c Command) String() string

type Key

type Key []byte

func KeyFromB64

func KeyFromB64(k string) Key

func (Key) B64

func (k Key) B64() string

func (Key) Bucket

func (k Key) Bucket(numBuckets int) int

type Operation

type Operation uint8
const (
	NOOP Operation = iota
	PUT
	GET
	DELETE
	TX_LEASE
)

type Store

type Store interface {
	Execute(c Command, ID ids.ID) (Value, error)
}

StateMachine interface provides execution of command against database the implementation should be thread safe

func NewStore

func NewStore() Store

NewStore get the instance of LevelDB Wrapper

type TxCommandMeta

type TxCommandMeta struct {
	CmdCommitted   bool
	CmdWaitingExec bool
	Slot           int
}

type Value

type Value []byte

Jump to

Keyboard shortcuts

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