Documentation ¶
Index ¶
- Constants
- type LookupTracingNode
- func (n *LookupTracingNode) Child(rightChild bool) (coname.MerkleNode, error)
- func (n *LookupTracingNode) ChildHash(rightChild bool) []byte
- func (n *LookupTracingNode) Depth() int
- func (n *LookupTracingNode) Index() []byte
- func (n *LookupTracingNode) IsEmpty() bool
- func (n *LookupTracingNode) IsLeaf() bool
- func (n *LookupTracingNode) Value() []byte
- type MerkleTree
- type NewSnapshot
- type Snapshot
Constants ¶
const ( NodePrefix = 'T' AllocCounterKey = "AC" NodeKeyDelimiter = 'N' SnapshotNrBytes = 8 IndexLengthBytes = 4 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LookupTracingNode ¶
type LookupTracingNode struct {
// contains filtered or unexported fields
}
func (*LookupTracingNode) Child ¶
func (n *LookupTracingNode) Child(rightChild bool) (coname.MerkleNode, error)
func (*LookupTracingNode) ChildHash ¶
func (n *LookupTracingNode) ChildHash(rightChild bool) []byte
func (*LookupTracingNode) Depth ¶
func (n *LookupTracingNode) Depth() int
func (*LookupTracingNode) Index ¶
func (n *LookupTracingNode) Index() []byte
func (*LookupTracingNode) IsEmpty ¶
func (n *LookupTracingNode) IsEmpty() bool
func (*LookupTracingNode) IsLeaf ¶
func (n *LookupTracingNode) IsLeaf() bool
func (*LookupTracingNode) Value ¶
func (n *LookupTracingNode) Value() []byte
type MerkleTree ¶
type MerkleTree struct {
// contains filtered or unexported fields
}
func AccessMerkleTree ¶
AccessMerkleTree opens the Merkle tree stored in the DB. There should never be two different MerkleTree objects accessing the same tree.
func (*MerkleTree) GetSnapshot ¶
func (tree *MerkleTree) GetSnapshot(nr uint64) *Snapshot
GetSnapshot loads the snapshot with a particular ID. Use 0 for a new empty snapshot. GetSnapshot always returns a snapshot handle, regardless of whether the snapshot actually exists. It is an error to call GetSnapshot(nr) if snapshot nr does not exist (a dangling snapshot handle will be returned).
type NewSnapshot ¶
type NewSnapshot struct { Snapshot // contains filtered or unexported fields }
NewSnapshot represents a snapshot that is being built up in memory.
func (*NewSnapshot) Flush ¶
func (snapshot *NewSnapshot) Flush(wb kv.Batch) (flushed *Snapshot)
Flush returns a newly usable Snapshot
type Snapshot ¶
type Snapshot struct { Nr uint64 // contains filtered or unexported fields }
Snapshot represents a particular (immutable) state of the tree. Changes are made by calling BeginModification(), updating the returned NewSnapshot, and then getting an updated Snapshot out from Flush().
func (*Snapshot) BeginModification ¶
func (snapshot *Snapshot) BeginModification() (*NewSnapshot, error)
BeginModification creates a new snapshot to be built up in memory (doesn't actually touch the disk yet)
func (*Snapshot) GetRootHash ¶
GetRootHash gets the summary hash for the entire state of the tree.