Interface IRunSearchIndex
- Namespace
- FlowOrchestrator.Core.Storage
- Assembly
- FlowOrchestrator.Core.dll
Optional text-search index for the run list's deep (step payload) search. When one is active, a
store resolves a deep Text term through the index — run ids only — and
reads the matching rows by primary key, instead of scanning step payloads with LIKE.
public interface IRunSearchIndex
Remarks
Built-in: options.UseRunSearchIndex() enables the token table on SQL Server
(SqlServerRunSearchTokenIndex). It is maintained by the store's own write statements and
back-filled newest-first in the background. Other providers ignore the option for now.
Custom: register an implementation as IRunSearchIndex (Elasticsearch, Azure AI Search, SQL Server Full-Text Search…). The SQL Server store then calls IndexRunAsync(RunSearchDocument, CancellationToken) / IndexStepAsync(StepSearchDocument, CancellationToken) after its durable writes and RemoveRunsAsync(IReadOnlyCollection<Guid>, CancellationToken) from retention, and asks SearchAsync(RunSearchIndexQuery, CancellationToken) for deep searches.
Write calls are best-effort and happen after the durable write, with None: a failure is swallowed and never fails the step. An index may therefore lag or miss a document; it must never be the source of truth for run state.
Properties
Capabilities
What this index can answer.
RunSearchCapabilities Capabilities { get; }
Property Value
Methods
IndexRunAsync(RunSearchDocument, CancellationToken)
Indexes the run-level fields. Called once, after the run row is written.
ValueTask IndexRunAsync(RunSearchDocument run, CancellationToken cancellationToken)
Parameters
runRunSearchDocumentThe run projection.
cancellationTokenCancellationTokenNever a request token: indexing outlives any HTTP request.
Returns
- ValueTask
A task that completes when the index accepted the document.
IndexStepAsync(StepSearchDocument, CancellationToken)
Indexes one completed step. Called after the step's completion is durable; must cost O(size of this step), never O(steps in the run).
ValueTask IndexStepAsync(StepSearchDocument step, CancellationToken cancellationToken)
Parameters
stepStepSearchDocumentThe step projection.
cancellationTokenCancellationTokenNever a request token.
Returns
- ValueTask
A task that completes when the index accepted the document.
RemoveRunsAsync(IReadOnlyCollection<Guid>, CancellationToken)
Removes every document of the given runs (retention).
Task RemoveRunsAsync(IReadOnlyCollection<Guid> runIds, CancellationToken cancellationToken)
Parameters
runIdsIReadOnlyCollection<Guid>Runs deleted by retention.
cancellationTokenCancellationTokenCancels the delete.
Returns
- Task
A task that completes when the documents are gone.
SearchAsync(RunSearchIndexQuery, CancellationToken)
Returns matching run ids newest first, at most Limit.
Task<RunSearchIndexResult> SearchAsync(RunSearchIndexQuery query, CancellationToken cancellationToken)
Parameters
queryRunSearchIndexQueryThe text query.
cancellationTokenCancellationTokenThe request token: a search is a read and may be abandoned.
Returns
- Task<RunSearchIndexResult>
The matching run ids.