dag

package
v0.5.0-rc8 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFindAllTailsFailed = errors.New("Unable to find all tails")
)

Functions

func FindAllTails

func FindAllTails(startTxHash hornet.Hash, skipStartTx bool, forceRelease bool) (map[string]struct{}, error)

FindAllTails searches all tail transactions the given startTxHash references. If skipStartTx is true, the startTxHash will be ignored and traversed, even if it is a tail transaction.

func GetTransactionRootSnapshotIndexes added in v0.5.0

func GetTransactionRootSnapshotIndexes(cachedTx *tangle.CachedTransaction, lsmi milestone.Index) (youngestTxRootSnapshotIndex milestone.Index, oldestTxRootSnapshotIndex milestone.Index)

GetTransactionRootSnapshotIndexes searches the transaction root snapshot indexes for a given transaction.

func TraverseApprovees

func TraverseApprovees(startTxHash hornet.Hash, condition Predicate, consumer Consumer, onMissingApprovee OnMissingApprovee, onSolidEntryPoint OnSolidEntryPoint, forceRelease bool, traverseSolidEntryPoints bool, traverseTailsOnly bool, abortSignal <-chan struct{}) error

TraverseApprovees starts to traverse the approvees (past cone) of the given start transaction until the traversal stops due to no more transactions passing the given condition. It is a DFS with trunk / branch. Caution: condition func is not in DFS order

func TraverseApproveesTrunkBranch added in v0.5.0

func TraverseApproveesTrunkBranch(trunkTxHash hornet.Hash, branchTxHash hornet.Hash, condition Predicate, consumer Consumer, onMissingApprovee OnMissingApprovee, onSolidEntryPoint OnSolidEntryPoint, forceRelease bool, traverseSolidEntryPoints bool, traverseTailsOnly bool, abortSignal <-chan struct{}) error

TraverseApproveesTrunkBranch starts to traverse the approvees (past cone) of the given trunk transaction until the traversal stops due to no more transactions passing the given condition. Afterwards it traverses the approvees (past cone) of the given branch transaction. It is a DFS with trunk / branch. Caution: condition func is not in DFS order

func TraverseApprovers added in v0.5.0

func TraverseApprovers(startTxHash hornet.Hash, condition Predicate, consumer Consumer, forceRelease bool, abortSignal <-chan struct{}) error

TraverseApprovers starts to traverse the approvers (future cone) of the given start transaction until the traversal stops due to no more transactions passing the given condition. It is unsorted BFS because the approvers are not ordered in the database.

func UpdateOutdatedRootSnapshotIndexes added in v0.5.0

func UpdateOutdatedRootSnapshotIndexes(outdatedTransactions hornet.Hashes, lsmi milestone.Index)

UpdateOutdatedRootSnapshotIndexes updates the transaction root snapshot indexes of the given transactions. the "outdatedTransactions" should be ordered from oldest to latest to avoid recursion.

func UpdateTransactionRootSnapshotIndexes added in v0.5.0

func UpdateTransactionRootSnapshotIndexes(txHashes hornet.Hashes, lsmi milestone.Index)

UpdateTransactionRootSnapshotIndexes updates the transaction root snapshot indexes of the future cone of all given transactions. all the transactions of the newly confirmed cone already have updated transaction root snapshot indexes. we have to walk the future cone, and update the past cone of all transactions that reference an old cone. as a special property, invocations of the yielded function share the same 'already traversed' set to circumvent walking the future cone of the same transactions multiple times.

Types

type Consumer

type Consumer func(cachedTx *tangle.CachedTransaction) error

Consumer consumes the given transaction during traversal.

type OnMissingApprovee

type OnMissingApprovee func(approveeHash hornet.Hash) error

OnMissingApprovee gets called when during traversal an approvee is missing.

type OnSolidEntryPoint added in v0.4.1

type OnSolidEntryPoint func(txHash hornet.Hash)

OnSolidEntryPoint gets called when during traversal the startTx or approvee is a solid entry point.

type Predicate

type Predicate func(cachedTx *tangle.CachedTransaction) (bool, error)

Predicate defines whether a traversal should continue or not.

Jump to

Keyboard shortcuts

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