Interface ITraverser<TProducts, TEffectTarget>
A traverser traverses the resultant ISeedTProducts
given the
information available in the seed tree.
Inherited Members
Namespace: Snowflake.Scraping.Extensibility
Assembly: Snowflake.Framework.Primitives.dll
Syntax
public interface ITraverser<TProducts, in TEffectTarget> : IPlugin, IDisposable
Type Parameters
Name | Description |
---|---|
TProducts | The type of record or object this traverser produces. |
TEffectTarget | The type of object this traverser is allowed to mutate. |
Methods
Traverse(TEffectTarget, ISeed, ISeedRootContext, CancellationToken)
Traverses the seed tree to yield objects of type TProducts
,
which, while being enumerated, may cause side effects to the provided sideEffectContext
.
This may mean that the provided products are already applied to the sideEffectContext
,
and should not be reapplied as enumerated.
Although the full seed root context is provided, it is best practice for traversers to
traverse relative to the given relativeRoot
.
Declaration
IAsyncEnumerable<TProducts> Traverse(TEffectTarget sideEffectContext, ISeed relativeRoot, ISeedRootContext context, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
TEffect |
sideEffectContext | The mutable object onto which side effects may be applied |
ISeed | relativeRoot | The seed to begin traversing from. |
ISeed |
context | The seed context within where the seeds can be traversed. |
System. |
cancellationToken | The cancellation token passed to the async enumerable. |
Returns
Type | Description |
---|---|
System. |
Objects based on values found in the tree. |
TraverseAll(TEffectTarget, ISeed, ISeedRootContext, CancellationToken)
Gets the task awaiter for traversers. Traversers must be awaited context free and thus is always configured to not continue on captured context.
Declaration
Task<IEnumerable<TProducts>> TraverseAll(TEffectTarget sideEffectContext, ISeed relativeRoot, ISeedRootContext context, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
TEffect |
sideEffectContext | The mutable object onto which side effects may be applied |
ISeed | relativeRoot | The seed to begin traversing from. |
ISeed |
context | The seed context within where the seeds can be traversed. |
System. |
cancellationToken |
Returns
Type | Description |
---|---|
System. |
Objects based on values found in the tree. |