Documentation ¶
Index ¶
- Constants
- func Verify(key, value, proof, root []byte) (bool, error)
- type GravitonState
- func (g *GravitonState) AddTree(name string) error
- func (g *GravitonState) Close() error
- func (g *GravitonState) Commit() ([]byte, error)
- func (g *GravitonState) Hash() []byte
- func (g *GravitonState) ImmutableTree(name string) statedb.StateTree
- func (g *GravitonState) Init(storagePath, storageType string) (err error)
- func (g *GravitonState) KeyDiff(rootSmall, rootBig []byte) ([][]byte, error)
- func (g *GravitonState) LoadVersion(v int64) error
- func (g *GravitonState) Rollback() error
- func (g *GravitonState) Tree(name string) statedb.StateTree
- func (g *GravitonState) TreeWithRoot(root []byte) statedb.StateTree
- func (g *GravitonState) Version() uint64
- type GravitonTree
- func (t *GravitonTree) Add(key, value []byte) error
- func (t *GravitonTree) Commit() error
- func (t *GravitonTree) Count() uint64
- func (t *GravitonTree) Get(key []byte) []byte
- func (t *GravitonTree) Hash() []byte
- func (t *GravitonTree) Init() error
- func (t *GravitonTree) Iterate(prefix []byte, callback func(key, value []byte) bool)
- func (t *GravitonTree) Proof(key []byte) ([]byte, error)
- func (t *GravitonTree) Verify(key, value, proof, root []byte) bool
- func (t *GravitonTree) Version() uint64
- type VersionTree
- func (v *VersionTree) Add(name string, version uint64) error
- func (v *VersionTree) Commit() error
- func (v *VersionTree) Get(name string) (uint64, error)
- func (v *VersionTree) Init(g *graviton.Store) error
- func (v *VersionTree) LoadVersion(version int64) error
- func (v *VersionTree) String() (s string)
- func (v *VersionTree) Version() uint64
Constants ¶
View Source
const ( GravitonHashSizeBytes = graviton.HASHSIZE_BYTES GravitonMaxKeySize = graviton.MAX_KEYSIZE GravitonMaxValueSize = graviton.MAX_VALUE_SIZE )
Variables ¶
This section is empty.
Functions ¶
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) 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) 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) Commit ¶
func (v *VersionTree) Commit() 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
Click to show internal directories.
Click to hide internal directories.