store

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CacheSize   = 1000
	StateDbName = "mstate"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type KVCache

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

KVCache used by the app. It wraps a simple cache and access to the State Store

func NewCache

func NewCache(store *StateStore) *KVCache

NewCache return a fresh empty cache with ref to the State Store

func (*KVCache) ApplyToState

func (cache *KVCache) ApplyToState()

ApplyToState is called during abci.commit(). It sorts all keys in the cache for determinism, then writes the set to the tree

func (*KVCache) Get

func (cache *KVCache) Get(key []byte) []byte

Get a value for a given key. Try the cache first and then the state db

func (*KVCache) IterateKeyRange

func (cache *KVCache) IterateKeyRange(start, end []byte, ascending bool, fn func(key []byte, value []byte) bool) bool

IterateKeyRange returns results that are processed via the callback func

func (*KVCache) Set

func (cache *KVCache) Set(key, val []byte)

Set a key in the cache

type StateStore

type StateStore struct {
	CommitInfo sdk.CommitInfo
	// contains filtered or unexported fields
}

func NewStateStore

func NewStateStore(dbdir string) *StateStore

func (*StateStore) Close

func (st *StateStore) Close()

func (*StateStore) Commit

func (st *StateStore) Commit() sdk.CommitInfo

func (*StateStore) Get

func (st *StateStore) Get(key []byte) []byte

func (*StateStore) IterateKeyRange

func (st *StateStore) IterateKeyRange(start, end []byte, ascending bool, fn func(key []byte, value []byte) bool) bool

IterateKeyRange - iterator non-inclusive

func (*StateStore) Query

func (st *StateStore) Query(req abci.RequestQuery) (res abci.ResponseQuery)

Query returns a value and/or proof from the tree. TODO: This is not really exposed to the app yet via the Query Context

func (*StateStore) RefreshCache

func (st *StateStore) RefreshCache() sdk.Cache

func (*StateStore) Set

func (st *StateStore) Set(key, val []byte)

Jump to

Keyboard shortcuts

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