Skip to main content

IRecomputeOrchestrator

Namespace: Meshmakers.Octo.Runtime.Contracts.StreamData

Tenant-scoped coordinator for optimistic rollup recompute (AB#4184). Exposed as an interface so host wiring (the per-tenant context, the background service) depends on the contract rather than the engine implementation — mirroring IRollupOrchestrator.

public interface IRecomputeOrchestrator

Methods

TickAsync(CancellationToken)

One periodic tick: fan out every source's dirty windows onto its dependents, then drain each activated rollup's pending recompute ranges. Returns the number of recompute runs executed.

Task<int> TickAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Returns

Task<Int32>

RecomputeArchiveAsync(OctoObjectId, DateTime, DateTime, Nullable<OctoObjectId>, RecomputeTrigger, CancellationToken)

Executes (or coalesces) one recompute of a rollup over the bucket-aligned range [from, to), optionally scoped to a single . Backs the manual recompute API.

Task<RecomputeJobSnapshot> RecomputeArchiveAsync(OctoObjectId rollupRtId, DateTime from, DateTime to, Nullable<OctoObjectId> rtIdScope, RecomputeTrigger trigger, CancellationToken cancellationToken)

Parameters

rollupRtId OctoObjectId

from DateTime

to DateTime

rtIdScope Nullable<OctoObjectId>

trigger RecomputeTrigger

cancellationToken CancellationToken

Returns

Task<RecomputeJobSnapshot>

PropagateDirtyWindowsAsync(OctoObjectId, CancellationToken)

Turns a source archive's retroactive dirty windows into pending recompute ranges on its direct dependents, then clears the windows (Information A → B).

Task PropagateDirtyWindowsAsync(OctoObjectId sourceArchiveRtId, CancellationToken cancellationToken)

Parameters

sourceArchiveRtId OctoObjectId

cancellationToken CancellationToken

Returns

Task

EnqueueBackfillFromSourceAsync(OctoObjectId, CancellationToken)

Queues a durable, background backfill of a rollup over the entire history of its source archive without the operator supplying a timestamp (AB#4269 / AB#4286). Resolves the source archive's earliest stored timestamp, snaps it down to the rollup's bucket boundary, and enqueues a persisted pending recompute range[sourceMin, now) plus a RecomputeJobState.PendingRecomputeJobSnapshot, then returns immediately — it does not run the recompute inline.

The heavy recompute is executed later by the background recompute orchestrator tick (IRecomputeOrchestrator.TickAsync(CancellationToken)), which adopts the pre-created Pending job and drives it Pending → Running → Completed under the host's application-lifetime cancellation token, never a caller's HTTP request token. This decouples a multi-minute (e.g. decade-long) backfill from the client request lifetime so a client HTTP timeout / disconnect can no longer cancel it, and the persisted pending range survives an asset-repo restart (picked up on the next tick).

The returned Pending job is pollable via the recompute-jobs query so the caller can watch its own backfill progress. When a recompute job is already active for the rollup, the range is folded into it and that active job is returned instead. Returns null when the source archive holds no data (no-op).

Task<RecomputeJobSnapshot> EnqueueBackfillFromSourceAsync(OctoObjectId rollupRtId, CancellationToken cancellationToken)

Parameters

rollupRtId OctoObjectId

cancellationToken CancellationToken

Returns

Task<RecomputeJobSnapshot>