iavl

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2019 License: Apache-2.0 Imports: 3 Imported by: 7

Documentation

Index

Constants

View Source
const (
	DefaultCacheSize int   = 10000
	DefaultHistory   int64 = 20
)

TODO: make these configurable?

Variables

This section is empty.

Functions

This section is empty.

Types

type CommitStore

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

CommitStore manages a iavl committed state

func MockCommitStore

func MockCommitStore() CommitStore

MockCommitStore creates a new in-memory store for testing

func NewCommitStore

func NewCommitStore(path, name string) CommitStore

NewCommitStore creates a new store with disk backing

func NewCommitStoreFromTree added in v0.11.2

func NewCommitStoreFromTree(tree *iavl.MutableTree) CommitStore

NewCommitStoreFromTree accepts a preloaded MutableTree and wraps it Mainly designed for test code... or devs who want full control

func (CommitStore) Adapter

func (s CommitStore) Adapter() store.CacheableKVStore

Adapter returns a wrapped version of the tree.

Data written here is stored in the tip of the version tree, and will be written to disk on Commit. There is no way to rollback writes here, without throwing away the CommitStore and re-loading from disk.

func (CommitStore) CacheWrap

func (s CommitStore) CacheWrap() store.KVCacheWrap

CacheWrap wraps the Adapter with a cache, so it may be written or discarded as needed.

func (CommitStore) Commit

func (s CommitStore) Commit() store.CommitID

Commit the next version to disk, and returns info

func (CommitStore) Get

func (s CommitStore) Get(key []byte) []byte

Get returns the value at last committed state returns nil iff key doesn't exist. Panics on nil key.

func (CommitStore) LatestVersion

func (s CommitStore) LatestVersion() store.CommitID

LatestVersion returns info on the latest version saved to disk

func (CommitStore) LoadLatestVersion

func (s CommitStore) LoadLatestVersion() error

LoadLatestVersion loads the latest persisted version. If there was a crash during the last commit, it is guaranteed to return a stable state, even if older.

Jump to

Keyboard shortcuts

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