leveldb

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store uses LevelDB to store values.

func NewInMemoryStateStore

func NewInMemoryStateStore(l logging.Logger) (*Store, error)

func NewStateStore

func NewStateStore(path string, l logging.Logger) (*Store, error)

NewStateStore creates a new persistent state storage.

func (*Store) Close

func (s *Store) Close() error

Close releases the resources used by the store.

func (*Store) DB

func (s *Store) DB() *leveldb.DB

DB implements StateStorer.DB method.

func (*Store) Delete

func (s *Store) Delete(key string) (err error)

Delete removes entries stored under a specific key.

func (*Store) Get

func (s *Store) Get(key string, i interface{}) error

Get retrieves a value of the requested key. If no results are found, storage.ErrNotFound will be returned.

func (*Store) Iterate

func (s *Store) Iterate(prefix string, iterFunc storage.StateIterFunc) (err error)

Iterate entries that match the supplied prefix.

func (*Store) Nuke

func (s *Store) Nuke() error

Nuke the store so that only the bare essential entries are left. Careful!

func (*Store) Put

func (s *Store) Put(key string, i interface{}) (err error)

Put stores a value for an arbitrary key. BinaryMarshaler interface method will be called on the provided value with fallback to JSON serialization.

Jump to

Keyboard shortcuts

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