tree

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultTreePos

func DefaultTreePos(size int) []hotstuff.ID

DefaultTreePos returns the tree positions of the replicas.

func DefaultTreePosUint32

func DefaultTreePosUint32(size int) []uint32

DefaultTreePosUint32 returns the tree positions of the replicas.

func Shuffle

func Shuffle(treePositions []uint32)

Types

type Tree

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

Tree contains the local replica's ID which must be part of the tree. Once created, the tree is immutable.

func CreateTree

func CreateTree(myID hotstuff.ID, bf int, ids []hotstuff.ID) Tree

CreateTree creates the tree configuration.

func (Tree) ChildrenOf

func (t Tree) ChildrenOf(replicaID hotstuff.ID) []hotstuff.ID

ChildrenOf returns the children of a specific replica.

func (Tree) IsRoot

func (t Tree) IsRoot(replicaID hotstuff.ID) bool

IsRoot return true if the replica is at root of the tree.

func (Tree) Parent

func (t Tree) Parent() (hotstuff.ID, bool)

Parent returns the ID of the parent of this tree's replica and true. If this tree's replica is the root, the root's ID is returned and false to indicate it does not have a parent.

func (Tree) PeersOf

func (t Tree) PeersOf() []hotstuff.ID

PeersOf returns the sibling peers of the tree's replica, unless the replica is the root, in which case there are no siblings.

func (Tree) ReplicaChildren

func (t Tree) ReplicaChildren() []hotstuff.ID

ReplicaChildren returns the children of this tree's replica, if any.

func (Tree) ReplicaHeight

func (t Tree) ReplicaHeight() int

ReplicaHeight returns the height of this tree's replica.

func (Tree) Root

func (t Tree) Root() hotstuff.ID

Root returns the ID of the root of the tree.

func (*Tree) SetAggregationWaitTime

func (t *Tree) SetAggregationWaitTime(lm latency.Matrix, delta time.Duration)

SetAggregationWaitTime sets the wait time for the aggregation of votes based on the highest latency path from node id to its leaf nodes. Only one of SetAggregationWaitTime or SetTreeHeightWaitTime should be called.

func (*Tree) SetTreeHeightWaitTime

func (t *Tree) SetTreeHeightWaitTime(delta time.Duration)

SetTreeHeightWaitTime sets the wait time for the aggregation of votes based on the height of the tree. Only one of SetAggregationWaitTime or SetTreeHeightWaitTime should be called.

func (Tree) SubTree

func (t Tree) SubTree() []hotstuff.ID

SubTree returns all subtree replicas of this tree's replica.

func (Tree) TreeHeight

func (t Tree) TreeHeight() int

TreeHeight returns the height of the full tree.

func (*Tree) WaitTime

func (t *Tree) WaitTime() time.Duration

WaitTime returns the expected time to wait for the aggregation of votes.

Jump to

Keyboard shortcuts

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