Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Tree ¶
type Tree interface { // Add a mapping from blkID to parentID. // // Invariant: blkID must not be equal to parentID // Invariant: a given blkID must only ever have one parentID Add(blkID ids.ID, parentID ids.ID) // Has returns if blkID's parentID is known by the tree. Has(blkID ids.ID) bool // GetAncestor returns the oldest known ancestor of blkID. If there is no // known parentID of blkID, blkID will be returned. GetAncestor(blkID ids.ID) ids.ID // Remove the mapping from blkID to its parentID from the tree. Remove(blkID ids.ID) // RemoveDescendants removes blkID from the tree along with all of its known // descendants. RemoveDescendants(blkID ids.ID) // Len returns the total number of blkID to parentID mappings that are // currently tracked by the tree. Len() int }
Tree manages a (potentially partial) view of a tree.
For example, assume this is the full tree:
A / \ B D | | C E
A partial view of this tree may be:
A / B D | | C E
Or:
B D | | C E
This structure is designed to update and traverse these partial views.
Click to show internal directories.
Click to hide internal directories.