Documentation ¶
Index ¶
- func GetConeRootIndexes(s *storage.Storage, cachedMsgMeta *storage.CachedMetadata, cmi milestone.Index) (youngestConeRootIndex milestone.Index, oldestConeRootIndex milestone.Index)
- func TraverseChildren(storage *storage.Storage, startMessageID hornet.MessageID, condition Predicate, ...) error
- func TraverseParents(storage *storage.Storage, parents hornet.MessageIDs, condition Predicate, ...) error
- func TraverseParentsOfMessage(storage *storage.Storage, startMessageID hornet.MessageID, condition Predicate, ...) error
- func UpdateConeRootIndexes(s *storage.Storage, metadataMemcache *storage.MetadataMemcache, ...)
- type ChildrenTraverser
- type Consumer
- type OnMissingParent
- type OnSolidEntryPoint
- type ParentTraverser
- type Predicate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetConeRootIndexes ¶ added in v1.0.0
func GetConeRootIndexes(s *storage.Storage, cachedMsgMeta *storage.CachedMetadata, cmi milestone.Index) (youngestConeRootIndex milestone.Index, oldestConeRootIndex milestone.Index)
GetConeRootIndexes searches the cone root indexes for a given message. cachedMsgMeta has to be solid, otherwise youngestConeRootIndex and oldestConeRootIndex will be 0 if a message is missing in the cone.
func TraverseChildren ¶ added in v1.0.0
func TraverseChildren(storage *storage.Storage, startMessageID hornet.MessageID, condition Predicate, consumer Consumer, walkAlreadyDiscovered bool, abortSignal <-chan struct{}, iteratorOptions ...storage.IteratorOption) error
TraverseChildren starts to traverse the children (future cone) of the given start message until the traversal stops due to no more messages passing the given condition. It is unsorted BFS because the children are not ordered in the database.
func TraverseParents ¶ added in v1.0.0
func TraverseParents(storage *storage.Storage, parents hornet.MessageIDs, condition Predicate, consumer Consumer, onMissingParent OnMissingParent, onSolidEntryPoint OnSolidEntryPoint, traverseSolidEntryPoints bool, abortSignal <-chan struct{}) error
TraverseParents starts to traverse the parents (past cone) in the given order until the traversal stops due to no more messages passing the given condition. It is a DFS of the paths of the parents one after another. Caution: condition func is not in DFS order
func TraverseParentsOfMessage ¶ added in v1.0.0
func TraverseParentsOfMessage(storage *storage.Storage, startMessageID hornet.MessageID, condition Predicate, consumer Consumer, onMissingParent OnMissingParent, onSolidEntryPoint OnSolidEntryPoint, traverseSolidEntryPoints bool, abortSignal <-chan struct{}) error
TraverseParentsOfMessage starts to traverse the parents (past cone) of the given start message until the traversal stops due to no more messages passing the given condition. It is a DFS of the paths of the parents one after another. Caution: condition func is not in DFS order
func UpdateConeRootIndexes ¶ added in v1.0.0
func UpdateConeRootIndexes(s *storage.Storage, metadataMemcache *storage.MetadataMemcache, messageIDs hornet.MessageIDs, cmi milestone.Index, iteratorOptions ...storage.IteratorOption)
UpdateConeRootIndexes updates the cone root indexes of the future cone of all given messages. all the messages of the newly referenced cone already have updated cone root indexes. we have to walk the future cone, and update the past cone of all messages 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 messages multiple times.
Types ¶
type ChildrenTraverser ¶ added in v1.0.0
type ChildrenTraverser struct {
// contains filtered or unexported fields
}
func NewChildrenTraverser ¶ added in v1.0.0
func NewChildrenTraverser(s *storage.Storage, metadataMemcache ...*storage.MetadataMemcache) *ChildrenTraverser
NewChildrenTraverser create a new traverser to traverse the children (future cone)
func (*ChildrenTraverser) Cleanup ¶ added in v1.0.0
func (t *ChildrenTraverser) Cleanup(forceRelease bool)
Cleanup releases all the cached objects that have been traversed. This MUST be called by the user at the end.
func (*ChildrenTraverser) Traverse ¶ added in v1.0.0
func (t *ChildrenTraverser) Traverse(startMessageID hornet.MessageID, condition Predicate, consumer Consumer, walkAlreadyDiscovered bool, abortSignal <-chan struct{}, iteratorOptions ...storage.IteratorOption) error
Traverse starts to traverse the children (future cone) of the given start message until the traversal stops due to no more messages passing the given condition. It is unsorted BFS because the children are not ordered in the database.
type Consumer ¶
type Consumer func(cachedMetadata *storage.CachedMetadata) error
Consumer consumes the given message metadata during traversal.
type OnMissingParent ¶ added in v1.0.0
OnMissingParent gets called when during traversal a parent is missing.
type OnSolidEntryPoint ¶ added in v0.4.1
OnSolidEntryPoint gets called when during traversal the startMsg or parent is a solid entry point.
type ParentTraverser ¶ added in v1.0.0
type ParentTraverser struct {
// contains filtered or unexported fields
}
func NewParentTraverser ¶ added in v1.0.0
func NewParentTraverser(s *storage.Storage, metadataMemcache ...*storage.MetadataMemcache) *ParentTraverser
NewParentTraverser create a new traverser to traverse the parents (past cone)
func (*ParentTraverser) Cleanup ¶ added in v1.0.0
func (t *ParentTraverser) Cleanup(forceRelease bool)
Cleanup releases all the cached objects that have been traversed. This MUST be called by the user at the end.
func (*ParentTraverser) Traverse ¶ added in v1.0.0
func (t *ParentTraverser) Traverse(parents hornet.MessageIDs, condition Predicate, consumer Consumer, onMissingParent OnMissingParent, onSolidEntryPoint OnSolidEntryPoint, traverseSolidEntryPoints bool, abortSignal <-chan struct{}) error
Traverse starts to traverse the parents (past cone) in the given order until the traversal stops due to no more messages passing the given condition. It is a DFS of the paths of the parents one after another. Caution: condition func is not in DFS order