forest

package
v1.4.8 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Forest

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

Forest is a representation of multiple tries mapped by their state commitment hash.

func New

func New() *Forest

New returns a new empty forest.

func (*Forest) Has

func (f *Forest) Has(commit flow.StateCommitment) bool

Has returns whether a state commitment matches one of the trees within the forest.

func (*Forest) Parent

func (f *Forest) Parent(commit flow.StateCommitment) (flow.StateCommitment, bool)

Parent returns the parent of the given state commitment.

func (*Forest) Paths

func (f *Forest) Paths(commit flow.StateCommitment) ([]ledger.Path, bool)

Paths returns the matching tree's paths for the given state commitment.

func (*Forest) Reset

func (f *Forest) Reset(finalized flow.StateCommitment)

Reset deletes all tries that do not match the given state commitment.

func (*Forest) Save

func (f *Forest) Save(tree *trie.MTrie, paths []ledger.Path, parent flow.StateCommitment)

Save adds a tree to the forest.

func (*Forest) Tree

func (f *Forest) Tree(commit flow.StateCommitment) (*trie.MTrie, bool)

Tree returns the matching tree for the given state commitment.

Jump to

Keyboard shortcuts

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