Skip to main content

IArchiveLifecycleService

Namespace: Meshmakers.Octo.Runtime.Contracts.StreamData

Orchestrates state-machine transitions for CkArchive entities. DB-neutral: delegates DDL to IStreamDataRepository and entity reads/writes to the runtime repository stack. Status changes are audit-trailed via the existing event infrastructure.

public interface IArchiveLifecycleService

Remarks:

Transition rules (see streamdata-archive-concept §3, §11):

Created → Activated: provision Crate table; on DDL failure transition to Failed.

Activated ↔ Disabled: status only, no Crate side-effect.

Failed → Activated: retry DDL; idempotent.

Delete from any state: drop the Crate table and soft-delete the entity (rtState = Archived).

Operation order is always Crate first, Mongo last so retries converge after transient Mongo failures without leaving inconsistent state visible to callers.

Methods

ActivateAsync(OctoObjectId)

Activates the archive: provisions the Crate table and sets status = Activated. Allowed from Created, Disabled, and Failed. Re-validates all column paths against the current CK model before any DDL runs.

Task ActivateAsync(OctoObjectId archiveRtId)

Parameters

archiveRtId OctoObjectId

Returns

Task

DisableAsync(OctoObjectId)

Sets status = Disabled. Allowed from Activated. The Crate table is preserved.

Task DisableAsync(OctoObjectId archiveRtId)

Parameters

archiveRtId OctoObjectId

Returns

Task

EnableAsync(OctoObjectId)

Sets status = Activated from Disabled. Re-validates column paths against the current CK model; performs no DDL because the table already exists.

Task EnableAsync(OctoObjectId archiveRtId)

Parameters

archiveRtId OctoObjectId

Returns

Task

RetryActivationAsync(OctoObjectId)

Retries activation after a previous DDL failure. Allowed only from Failed; identical effect to IArchiveLifecycleService.ActivateAsync(OctoObjectId).

Task RetryActivationAsync(OctoObjectId archiveRtId)

Parameters

archiveRtId OctoObjectId

Returns

Task

DeleteAsync(OctoObjectId)

Drops the Crate table (idempotent) and soft-deletes the CkArchive entity by setting rtState = Archived. Allowed from any status.

Task DeleteAsync(OctoObjectId archiveRtId)

Parameters

archiveRtId OctoObjectId

Returns

Task