gravitonstate

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: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GravitonHashSizeBytes = graviton.HASHSIZE_BYTES
	GravitonMaxKeySize    = graviton.MAX_KEYSIZE
	GravitonMaxValueSize  = graviton.MAX_VALUE_SIZE
)

Variables

This section is empty.

Functions

func Verify

func Verify(key, value, proof, root []byte) (bool, error)

Types

type GravitonState

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

func (*GravitonState) AddTree

func (g *GravitonState) AddTree(name string) error

func (*GravitonState) Close

func (g *GravitonState) Close() error

func (*GravitonState) Commit

func (g *GravitonState) Commit() ([]byte, error)

Commit saves the current state of the trees and updates versions. Returns New Hash

func (*GravitonState) Hash

func (g *GravitonState) Hash() []byte

Hash returns the merkle root hash of all trees hash(hashTree1+hashTree2+...)

func (*GravitonState) ImmutableTree

func (g *GravitonState) ImmutableTree(name string) statedb.StateTree

ImmutableTree is a tree snapshot that won't change, useful for making queries on a state changing environment

func (*GravitonState) Init

func (g *GravitonState) Init(storagePath, storageType string) (err error)

func (*GravitonState) KeyDiff

func (g *GravitonState) KeyDiff(rootSmall, rootBig []byte) ([][]byte, error)

KeyDiff returns the list of inserted keys on rootBig not present in rootSmall

func (*GravitonState) LoadVersion

func (g *GravitonState) LoadVersion(v int64) error

LoadVersion loads a current version. Zero means last version, -1 means previous version. Values under -1 are not supported. Versions are obtained from a version Tree which stores the version of all existing trees.

func (*GravitonState) Rollback

func (g *GravitonState) Rollback() error

Rollback discards the non-committed changes of the tree

func (*GravitonState) Tree

func (g *GravitonState) Tree(name string) statedb.StateTree

func (*GravitonState) TreeWithRoot

func (g *GravitonState) TreeWithRoot(root []byte) statedb.StateTree

func (*GravitonState) Version

func (g *GravitonState) Version() uint64

type GravitonTree

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

func (*GravitonTree) Add

func (t *GravitonTree) Add(key, value []byte) error

func (*GravitonTree) Commit added in v1.0.3

func (t *GravitonTree) Commit() error

func (*GravitonTree) Count

func (t *GravitonTree) Count() uint64

func (*GravitonTree) Get

func (t *GravitonTree) Get(key []byte) []byte

func (*GravitonTree) Hash

func (t *GravitonTree) Hash() []byte

func (*GravitonTree) Init added in v1.0.3

func (t *GravitonTree) Init() error

func (*GravitonTree) Iterate

func (t *GravitonTree) Iterate(prefix []byte, callback func(key, value []byte) bool)

func (*GravitonTree) Proof

func (t *GravitonTree) Proof(key []byte) ([]byte, error)

func (*GravitonTree) Verify

func (t *GravitonTree) Verify(key, value, proof, root []byte) bool

func (*GravitonTree) Version

func (t *GravitonTree) Version() uint64

type VersionTree

type VersionTree struct {
	Name string
	// contains filtered or unexported fields
}

func (*VersionTree) Add

func (v *VersionTree) Add(name string, version uint64) error

func (*VersionTree) Commit

func (v *VersionTree) Commit() error

func (*VersionTree) Get

func (v *VersionTree) Get(name string) (uint64, error)

func (*VersionTree) Init

func (v *VersionTree) Init(g *graviton.Store) error

func (*VersionTree) LoadVersion

func (v *VersionTree) LoadVersion(version int64) error

func (*VersionTree) String

func (v *VersionTree) String() (s string)

func (*VersionTree) Version

func (v *VersionTree) Version() uint64

Jump to

Keyboard shortcuts

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