dag

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2020 License: Apache-2.0 Imports: 8 Imported by: 12

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) (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

func GetTransactionRootSnapshotIndexes(cachedTxMeta *tangle.CachedMetadata, 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, 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

func TraverseApproveesTrunkBranch(trunkTxHash hornet.Hash, branchTxHash hornet.Hash, condition Predicate, consumer Consumer, onMissingApprovee OnMissingApprovee, onSolidEntryPoint OnSolidEntryPoint, 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

func TraverseApprovers(startTxHash hornet.Hash, condition Predicate, consumer Consumer, walkAlreadyDiscovered 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

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

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 ApproveesTraverser

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

func NewApproveesTraverser

func NewApproveesTraverser(condition Predicate, consumer Consumer, onMissingApprovee OnMissingApprovee, onSolidEntryPoint OnSolidEntryPoint, abortSignal <-chan struct{}) *ApproveesTraverser

NewApproveesTraverser create a new traverser to traverse the approvees (past cone)

func (*ApproveesTraverser) Traverse

func (t *ApproveesTraverser) Traverse(startTxHash hornet.Hash, traverseSolidEntryPoints bool, traverseTailsOnly bool) error

Traverse 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 (*ApproveesTraverser) TraverseTrunkAndBranch

func (t *ApproveesTraverser) TraverseTrunkAndBranch(trunkTxHash hornet.Hash, branchTxHash hornet.Hash, traverseSolidEntryPoints bool, traverseTailsOnly bool) error

TraverseTrunkAndBranch 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

type ApproversTraverser

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

func NewApproversTraverser

func NewApproversTraverser(condition Predicate, consumer Consumer, walkAlreadyDiscovered bool, abortSignal <-chan struct{}) *ApproversTraverser

NewApproversTraverser create a new traverser to traverse the approvers (future cone)

func (*ApproversTraverser) Traverse

func (t *ApproversTraverser) Traverse(startTxHash hornet.Hash) error

Traverse 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.

type Consumer

type Consumer func(cachedTxMeta *tangle.CachedMetadata) error

Consumer consumes the given transaction metadata during traversal.

type OnMissingApprovee

type OnMissingApprovee func(approveeHash hornet.Hash) error

OnMissingApprovee gets called when during traversal an approvee is missing.

type OnSolidEntryPoint

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(cachedTxMeta *tangle.CachedMetadata) (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