Documentation ¶
Index ¶
- type Config
- type Group
- type MapStore
- type Node
- type Position
- type Positions
- type Store
- type Tree
- type TreeCalc
- func (tc *TreeCalc) BranchFactor() uint8
- func (tc TreeCalc) FirstNodeOfGroup(blkIdx *big.Int) *big.Int
- func (tc *TreeCalc) GroupCount(nodeCount *big.Int) *big.Int
- func (tc *TreeCalc) GroupOfNode(nodeIdx *big.Int) *big.Int
- func (tc *TreeCalc) Height(nleaf *big.Int) uint8
- func (tc *TreeCalc) NodeIndexInGroup(nodeIdx *big.Int) int
- type UpdateResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group is a Group of child nodes under the same parent node
func (*Group) MakeParent ¶
MakeParent compute the sum of the child nodes and returns the parent node
type MapStore ¶
type MapStore struct {
// contains filtered or unexported fields
}
MapStore is simple Store implementation
func (*MapStore) CommitUpdate ¶
func (ms *MapStore) CommitUpdate(res *UpdateResult)
CommitUpdate commits tree node updates
func (*MapStore) GetLeafCount ¶
GetLeafCount implement Store
type Position ¶
type Position struct {
// contains filtered or unexported fields
}
Position of a node in the tree
func NewPosition ¶
NewPosition create a new position
func UnmarshalPosition ¶
UnmarshalPosition unmarshals position from raw bytes
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
Tree implements a merkle tree engine
type TreeCalc ¶
type TreeCalc struct {
// contains filtered or unexported fields
}
TreeCalc calculates merkle tree properties
func (*TreeCalc) BranchFactor ¶
BranchFactor returns uint8 branch factor
func (TreeCalc) FirstNodeOfGroup ¶
FirstNodeOfGroup gives the index of first node of a group
e.g branch factor 5 [0 1 2 3 4] [5 6 7 _ _] // first node of block 1 is 0 and of block 2 is 5
func (*TreeCalc) GroupCount ¶
GroupCount gives the number of groups for a tree level with given node count
e.g branch factor 5
[0 1] // 2 parent nodes
[0 1 2 3 4] [5 6 7 _ _] // 8 nodes becomes 2 blocks
func (*TreeCalc) GroupOfNode ¶
GroupOfNode gives the group index in which the node exist
e.g branch factor 5 [0 1 2 3 4] [5 6 7 _ _] // group of node 1 is 0 and of node 7 is 2