maidenlanedkvstore

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KVIterator

type KVIterator interface {
	Key() string
	Value() []byte
	Next() bool
	Release()
}

KVIterator interface for key value iterators

type KVStore

type KVStore interface {
	Put(key string, val []byte) error
	Get(key string) ([]byte, error)
	Delete(key string) error
	NewIterator() KVIterator
	Close()
}

KVStore interface for key value stores

func NewLDBKeyValueStore

func NewLDBKeyValueStore(ldbPath string) (kv KVStore, err error)

NewLDBKeyValueStore construct a new LevelDB instance of a KV store

type MockKV

type MockKV struct {
	KVS       map[string][]byte
	StoreErr  error
	LoadErr   error
	DeleteErr error
}

MockKV simple memory K/V store for testing

func NewMockKV

func NewMockKV(err error) *MockKV

NewMockKV constructor

func (*MockKV) Close

func (m *MockKV) Close()

Close it

func (*MockKV) Delete

func (m *MockKV) Delete(key string) error

Delete a key

func (*MockKV) Get

func (m *MockKV) Get(key string) ([]byte, error)

Get a key

func (*MockKV) NewIterator

func (m *MockKV) NewIterator() KVIterator

NewIterator for a new iterator

func (*MockKV) Put

func (m *MockKV) Put(key string, val []byte) error

Put a key

Jump to

Keyboard shortcuts

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