Class AbstractBrowseExecutor<N extends HistoricalNode>
java.lang.Object
com.inductiveautomation.historian.gateway.api.query.browsing.AbstractBrowseExecutor<N>
- Type Parameters:
N- the node type produced by the backend's tree.
Drives a
BrowsePublisher from a HistoricalNodeTree. It walks the tree from the
root, applies the BrowseFilter (honoring HistorianBrowseTraits.INCLUDE_RETIRED,
HistorianBrowseTraits.INCLUDE_METADATA and HistorianBrowseTraits.LEAF_SEARCH),
and recurses into children when filter.isRecursive(). When filter.getMaxResults()
is reached, the executor is parked in a static continuation cache (10 minutes, 100 entries), and
backends resume it with resumeFromContinuation(String, BrowseFilter, BrowsePublisher).
Backends supply newChild(QualifiedPath, BrowseFilter, BrowsePublisher, LoggerEx) and may override getMetadata(N).
Not thread-safe: callers must serialize calls on one instance, including a cached executor. The cache itself is thread-safe.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractBrowseExecutor(HistoricalNodeTree<N> nodeTree, QualifiedPath root, BrowseFilter filter, BrowsePublisher publisher, LoggerEx parentLogger) Creates an executor rooted atroot. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidexecute()Runs the browse to completion or to the next continuation point.protected Optional<MetadataPoint> getMetadata(N node) Returns the metadata to attach to a published node whenHistorianBrowseTraits.INCLUDE_METADATAis set.protected abstract AbstractBrowseExecutor<N> newChild(QualifiedPath root, BrowseFilter filter, BrowsePublisher publisher, LoggerEx parentLogger) Creates the executor for a recursive browse.protected booleannodePassesRetirementFilter(N node, BrowseFilter filter, Instant now) Returns whether a node should be emitted.protected final booleannodePassesRetirementState(N node, RetirementState state, Instant now) Applies aRetirementStateselector to a node:ACTIVEpasses nodes with no retired time or one afternow,RETIREDpasses nodes retired at or beforenow, andALLpasses every node.static AbstractBrowseExecutor<?> resumeFromContinuation(String continuationId, BrowseFilter filter, BrowsePublisher publisher) Resumes a cached browse where it stopped, rebinding the filter and publisher.
-
Constructor Details
-
AbstractBrowseExecutor
protected AbstractBrowseExecutor(HistoricalNodeTree<N> nodeTree, QualifiedPath root, BrowseFilter filter, BrowsePublisher publisher, LoggerEx parentLogger) Creates an executor rooted atroot.- Parameters:
nodeTree- the backend's node tree.root- the path to browse from.filter- the browse filter.publisher- receives the results.parentLogger- the logger from which a"browse"sub-logger is derived.
-
-
Method Details
-
resumeFromContinuation
public static AbstractBrowseExecutor<?> resumeFromContinuation(String continuationId, BrowseFilter filter, BrowsePublisher publisher) Resumes a cached browse where it stopped, rebinding the filter and publisher.- Parameters:
continuationId- the id previously published viaBrowsePublisher.setContinuationPoint(String).filter- the filter for this resumption.publisher- the publisher for this resumption.- Returns:
- the executor, or
nullif the continuation expired or never existed.
-
execute
public final void execute()Runs the browse to completion or to the next continuation point. -
getMetadata
Returns the metadata to attach to a published node whenHistorianBrowseTraits.INCLUDE_METADATAis set. Empty by default; backends that carry metadata override.- Parameters:
node- the node being processed.- Returns:
- the metadata, or empty if none.
-
nodePassesRetirementFilter
Returns whether a node should be emitted. The default passes active nodes and passes retired nodes only whenHistorianBrowseTraits.INCLUDE_RETIREDis set. Backends with a tri-state retirement selector override this, usually by delegating tonodePassesRetirementState(N, RetirementState, Instant).- Parameters:
node- the candidate node.filter- the browse filter.now- the instant for this sweep; recursive child sweeps capture their own.- Returns:
trueto emit the node.
-
nodePassesRetirementState
Applies aRetirementStateselector to a node:ACTIVEpasses nodes with no retired time or one afternow,RETIREDpasses nodes retired at or beforenow, andALLpasses every node.- Parameters:
node- the candidate node.state- the selector.now- the instant for the enclosing sweep.- Returns:
trueto emit the node.
-
newChild
protected abstract AbstractBrowseExecutor<N> newChild(QualifiedPath root, BrowseFilter filter, BrowsePublisher publisher, LoggerEx parentLogger) Creates the executor for a recursive browse. Return an instance of the subclass's own type.- Parameters:
root- the child root path.filter- the filter, typically inherited.publisher- the recursive publisher.parentLogger- the logger from which the child's sub-logger is derived.- Returns:
- a child executor of the same concrete type.
-