iavl

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2020 License: Apache-2.0 Imports: 5 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, error)

Commit the next version to disk, and returns info

func (CommitStore) Get

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

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

func (CommitStore) LatestVersion

func (s CommitStore) LatestVersion() (store.CommitID, error)

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.

func (CommitStore) LoadVersion added in v0.16.0

func (s CommitStore) LoadVersion(version int64) error

LoadVersion loads a specific persisted version. When you load an old version, or when the last commit attempt didn't complete, the next commit after loading must be idempotent (return the same commit id). Otherwise the behavior is undefined.

Jump to

Keyboard shortcuts

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