IArchiveRecomputeExecutor
Namespace: Meshmakers.Octo.Runtime.Contracts.StreamData
Performs the actual recompute of a rollup over a bucket-aligned range: aggregate the
source archive into a per-job staging table and commit it atomically (full-archive
SWAP TABLE or per-window generation-pointer flip), so readers never observe a partial
state. The orchestrator owns the job lifecycle, coalescing, observability, and dependency
propagation; this interface owns only the storage-level compute + swap. The CrateDB
implementation lands in Phase 3c.
public interface IArchiveRecomputeExecutor
Methods
ExecuteAsync(ArchiveSnapshot, RollupArchiveSnapshot, DateTime, DateTime, Nullable<OctoObjectId>, CancellationToken)
Recomputes rollup for the half-open range
[rangeStart, rangeEnd) (optionally restricted to rtIdScope) by
aggregating source into staging and swapping atomically on success. Throws
if the compute or swap fails — leaving the previous committed state intact — so the
orchestrator can mark the job RecomputeJobState.Failed.
Task<RecomputeExecutionResult> ExecuteAsync(ArchiveSnapshot source, RollupArchiveSnapshot rollup, DateTime rangeStart, DateTime rangeEnd, Nullable<OctoObjectId> rtIdScope, CancellationToken cancellationToken)
Parameters
source ArchiveSnapshot
rollup RollupArchiveSnapshot
rangeStart DateTime
rangeEnd DateTime
rtIdScope Nullable<OctoObjectId>
cancellationToken CancellationToken
Returns
Task<RecomputeExecutionResult>
Remarks:
Single-source per call, unchanged: source is authoritative for
the whole range passed in. For a multi-source rollup the orchestrator splits the requested
range into per-source segments along the sources' validity spans first and calls in once per
segment, accumulating the job totals — so a segment never mixes two sources.
ExecuteScopedRefreshAsync(ArchiveSnapshot, RollupArchiveSnapshot, DateTime, DateTime, RtIdSet, CancellationToken)
Refreshes the series of rtIds of rollup in place for the half-open range
[rangeStart, rangeEnd) (late-delivery recompute): their buckets are aggregated from
source again and written at the generation each (bucket, rtId) row is read at today, so no new
generation, no pointer entry and no sweep of superseded rows is needed. Every other series is left untouched. The
result equals what IArchiveRecomputeExecutor.ExecuteAsync(ArchiveSnapshot, RollupArchiveSnapshot, DateTime, DateTime, Nullable<OctoObjectId>, CancellationToken) over the whole range produces for these series.
Task<RecomputeExecutionResult> ExecuteScopedRefreshAsync(ArchiveSnapshot source, RollupArchiveSnapshot rollup, DateTime rangeStart, DateTime rangeEnd, RtIdSet rtIds, CancellationToken cancellationToken)
Parameters
source ArchiveSnapshot
rollup RollupArchiveSnapshot
rangeStart DateTime
rangeEnd DateTime
rtIds RtIdSet
cancellationToken CancellationToken
Returns
Task<RecomputeExecutionResult>
Remarks:
Must only run while no other recompute of the rollup runs: the orchestrator's active-job guard serialises it with every unscoped, per-rtId and set-scoped recompute of the same rollup. A row is replaced atomically, so a reader sees each series either before or after the refresh.
The default implementation exists so that an implementation compiled against the contract in older versions keeps working in a mixed package set: one rtId is recomputed scoped through IArchiveRecomputeExecutor.ExecuteAsync(ArchiveSnapshot, RollupArchiveSnapshot, DateTime, DateTime, Nullable<OctoObjectId>, CancellationToken), several are recomputed with one unscoped IArchiveRecomputeExecutor.ExecuteAsync(ArchiveSnapshot, RollupArchiveSnapshot, DateTime, DateTime, Nullable<OctoObjectId>, CancellationToken) over the range (the behaviour in older versions - correct for every series, one generation instead of one per rtId). The CrateDB executor overrides it with the in-place refresh.