IArchiveRuntimeStore
Namespace: Meshmakers.Octo.Runtime.Contracts.StreamData
Abstracts the persistence operations on CkArchive entities required by
IArchiveLifecycleService. Decouples the lifecycle state machine from any
particular runtime repository implementation (Mongo today, possibly others later) and from the
generated CkArchive class itself, so the service stays in Runtime.Engine without
taking a hard dependency on the StreamData CK model package.
public interface IArchiveRuntimeStore
Methods
GetAsync(OctoObjectId)
Reads the current state of the archive identified by , or
null if no such entity exists (or has been soft-deleted).
Task<ArchiveSnapshot> GetAsync(OctoObjectId archiveRtId)
Parameters
archiveRtId OctoObjectId
Returns
SetStatusAsync(OctoObjectId, CkArchiveStatus)
Writes a new CkArchiveStatus on the archive entity. Implementations are responsible for any validation hooks (concept §10) and for emitting the corresponding status-transition event (§14) only if the lifecycle service hasn't already done so via IArchiveAuditTrail.
Task SetStatusAsync(OctoObjectId archiveRtId, CkArchiveStatus newStatus)
Parameters
archiveRtId OctoObjectId
newStatus CkArchiveStatus
Returns
ArchiveEntityAsync(OctoObjectId)
Soft-deletes the archive entity by setting rtState = Archived. The Crate table is
dropped separately by the lifecycle service via IStreamDataRepository.
Task ArchiveEntityAsync(OctoObjectId archiveRtId)
Parameters
archiveRtId OctoObjectId
Returns
EnumerateAsync()
Enumerates every non-soft-deleted CkArchive entity in the tenant. Used by the startup reconciliation job (concept §11) to compare Mongo state against CrateDB reality. Order is implementation-defined; callers must not rely on it.
IAsyncEnumerable<ArchiveSnapshot> EnumerateAsync()
Returns
IAsyncEnumerable<ArchiveSnapshot>
AddComputedColumnAsync(OctoObjectId, CkArchiveColumnSpec)
Appends a computed column to the archive's column set (AB#4189 Phase 7). The caller supplies the column already carrying its initial CkArchiveColumnSpec.ComputedState (normally ComputedColumnState.Pending for an add to a live archive). Used by the computed-column lifecycle on IArchiveLifecycleService.
Task AddComputedColumnAsync(OctoObjectId archiveRtId, CkArchiveColumnSpec column)
Parameters
archiveRtId OctoObjectId
column CkArchiveColumnSpec
Returns
SetComputedColumnStateAsync(OctoObjectId, String, ComputedColumnState)
Sets the engine-managed lifecycle ComputedColumnState of the computed column
named on the archive (AB#4189 Phase 7). This single write is the
atomic switch for the add flow: while the state is Pending / Backfilling the
read path hides the column; flipping it to Active exposes the backfilled values.
Task SetComputedColumnStateAsync(OctoObjectId archiveRtId, string name, ComputedColumnState state)
Parameters
archiveRtId OctoObjectId
name String
state ComputedColumnState
Returns
RemoveComputedColumnAsync(OctoObjectId, String)
Removes the computed column named from the archive's column set (AB#4189 Phase 7). The physical CrateDB column is left in place (a harmless nullable orphan the read path no longer projects); a later re-add of the same name reuses it.
Task RemoveComputedColumnAsync(OctoObjectId archiveRtId, string name)
Parameters
archiveRtId OctoObjectId
name String
Returns
SetPendingFormulaAsync(OctoObjectId, String, String)
Sets the transient PendingFormula marker on a computed column (AB#4189 Phase 7),
starting a formula change: the column keeps serving its current formula while ingest begins
dual-writing the pending formula into the versioned physical column. The column stays
Active throughout.
Task SetPendingFormulaAsync(OctoObjectId archiveRtId, string name, string pendingFormula)
Parameters
archiveRtId OctoObjectId
name String
pendingFormula String
Returns
SwapComputedColumnFormulaAsync(OctoObjectId, String, String, Int32)
Atomically swaps a computed column to its new formula once the backfill completes (AB#4189
Phase 7): sets Formula = newFormula, ComputedVersion = newVersion, and clears
PendingFormula in one write. After this the read path resolves the column to the new
versioned physical column.
Task SwapComputedColumnFormulaAsync(OctoObjectId archiveRtId, string name, string newFormula, int newVersion)
Parameters
archiveRtId OctoObjectId
name String
newFormula String
newVersion Int32
Returns
ClearPendingFormulaAsync(OctoObjectId, String)
Clears the PendingFormula marker without swapping (AB#4189 Phase 7), reverting a failed
formula change: the column keeps its previous formula / version and ingest stops dual-writing.
The orphaned pending physical column is left in place.
Task ClearPendingFormulaAsync(OctoObjectId archiveRtId, string name)
Parameters
archiveRtId OctoObjectId
name String