Documentation ¶
Index ¶
- type SafeTree
- func (s *SafeTree) Get(key []byte) (index int64, value []byte)
- func (s *SafeTree) GetVersioned(key []byte, version int64) (index int64, value []byte)
- func (s *SafeTree) Hash() []byte
- func (s *SafeTree) Load() (int64, error)
- func (s *SafeTree) Raw() interface{}
- func (s *SafeTree) Remove(key []byte) bool
- func (s *SafeTree) Rollback()
- func (s *SafeTree) SaveVersion() ([]byte, int64, error)
- func (s *SafeTree) Set(key, value []byte) bool
- func (s *SafeTree) Version() int64
- func (s *SafeTree) WorkingHash() []byte
- type Tree
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SafeTree ¶
SafeTree is a wrapper around Tendermint's IAVL that provides thread-safe operations
func NewSafeTree ¶
NewSafeTree creates an instance of SafeTree
func (*SafeTree) Get ¶
Get returns the index and value of the specified key if it exists, or nil and the next index, if it doesn't.
func (*SafeTree) GetVersioned ¶
GetVersioned gets the value at the specified key and version.
func (*SafeTree) Hash ¶
Hash returns the hash of the latest saved version of the tree, as returned by SaveVersion. If no versions have been saved, Hash returns nil.
func (*SafeTree) Rollback ¶
func (s *SafeTree) Rollback()
Rollback rolls back the tree to the latest version, discarding unsaved changes.
func (*SafeTree) SaveVersion ¶
SaveVersion saves a new tree version to disk, based on the current state of the tree. Returns the hash and new version number.
func (*SafeTree) Set ¶
Set sets a key in the working tree. Nil values are not supported. Returns true if the key existed and was updated.
func (*SafeTree) WorkingHash ¶
WorkingHash returns the hash of the current working tree.
type Tree ¶
type Tree interface { Version() int64 GetVersioned(key []byte, version int64) (index int64, value []byte) Get(key []byte) (index int64, value []byte) Set(key, value []byte) bool Remove(key []byte) bool SaveVersion() ([]byte, int64, error) Load() (int64, error) WorkingHash() []byte Hash() []byte }
Tree represents a merkle tree