statedb

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2021 License: AGPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StateDB

type StateDB interface {
	Init(storagePath, sorageType string) error
	Version() uint64
	LoadVersion(int64) error // zero means last version, -1 is the previous to the last version
	AddTree(name string) error
	Tree(name string) StateTree
	TreeWithRoot(root []byte) StateTree
	ImmutableTree(name string) StateTree // a tree version that won't change
	Commit() ([]byte, error)             // Returns New Hash
	Rollback() error
	KeyDiff(root1, root2 []byte) ([][]byte, error) // list of inserted keys on root2 that are not present in root1
	Hash() []byte
	Close() error
}

type StateTree

type StateTree interface {
	Get(key []byte) []byte
	Add(key, value []byte) error
	Iterate(prefix []byte, callback func(key, value []byte) bool)
	Hash() []byte
	Count() uint64
	Version() uint64
	Proof(key []byte) ([]byte, error)
	Verify(key, value, proof, root []byte) bool
	Commit() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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