Zum Hauptinhalt springen

ArchiveSnapshot

Namespace: Meshmakers.Octo.Runtime.Contracts.StreamData

Read-only snapshot of the parts of a CkArchive entity the lifecycle service needs. Intentionally narrower than the full RtEntity: the lifecycle decisions only depend on ArchiveSnapshot.Status plus identification fields. Backend-specific stores translate from their concrete representation to this record. Columns carries the user-configured archive columns (path/indexed/required) the data-store provider needs to generate DDL — empty when the archive only has the standard time-series columns.

public record ArchiveSnapshot : IEquatable<ArchiveSnapshot>

Inheritance Object → ArchiveSnapshot
Implements IEquatable<ArchiveSnapshot>

Properties​

RtId​

public OctoObjectId RtId { get; set; }

Property Value​

OctoObjectId

TargetCkTypeId​

public RtCkId<CkTypeId> TargetCkTypeId { get; set; }

Property Value​

RtCkId<CkTypeId>

Status​

public CkArchiveStatus Status { get; set; }

Property Value​

CkArchiveStatus

RtWellKnownName​

public string RtWellKnownName { get; set; }

Property Value​

String

Columns​

public IReadOnlyList<CkArchiveColumnSpec> Columns { get; set; }

Property Value​

IReadOnlyList<CkArchiveColumnSpec>

RollupAggregations​

When this snapshot represents a RollupArchive, the aggregation specs from which ArchiveSnapshot.Columns were derived (via RollupColumnGenerator). Null for raw and time-range archives. The DDL path uses this to skip CK-type attribute resolution for rollups — the derived column names (e.g. temperature_avg_sum) are storage identifiers, not paths into the CK type, so the column SQL type is determined by the aggregation function instead. Concept §4.

public IReadOnlyList<CkRollupAggregationSpec> RollupAggregations { get; set; }

Property Value​

IReadOnlyList<CkRollupAggregationSpec>

IsTimeRange​

True when this snapshot represents a TimeRangeArchive — each row carries an explicit [window_start, window_end) instead of a single timestamp. The DDL path emits two timestamp columns + a was_updated flag column, and the natural key becomes (window_start, window_end, rtid, ckTypeId). Concept §4 + §6.

public bool IsTimeRange { get; set; }

Property Value​

Boolean

Remarks:

Discriminator semantics: ArchiveSnapshot.RollupAggregations non-null ⇒ rollup; ArchiveSnapshot.IsTimeRange true ⇒ time-range; both false ⇒ raw archive. Rollups and time-range archives are mutually exclusive at the storage shape level (a rollup snapshot has IsTimeRange = false today; the rollup-on-time-range unification ships in Phase 7).

Period​

The archive's native window length (e.g. 15 min, 1 h, 1 d): a TimeRangeArchive's declared window Period, or a RollupArchive's BucketSize. Null for raw archives, whose sampling interval is undeclared. For time-range ingestion it stays advisory (the engine does not enforce that incoming windows match it); it is authoritative for the AB#4289 rollup activation guard (a rollup's bucket must be a multiple of its source's window length) and feeds the AB#4290 resolver's base-rung grain.

public Nullable<TimeSpan> Period { get; set; }

Property Value​

Nullable<TimeSpan>

UsesWindowedStorage​

True when this snapshot's storage shape is the windowed (window_start, window_end, rtid, ckTypeId) + was_updated layout — i.e. either a rollup archive (Phase 7 unification) or a time-range archive. False ⇒ raw archive with the single timestamp column. Concept-time-range §4 / §6.

public bool UsesWindowedStorage { get; }

Property Value​

Boolean

MaxRetroactiveReachMs​

Bounded retro reach (AB#4196): the maximum distance in milliseconds before the consumed watermark that a single retroactive write to this archive may drag an automatic recompute of its dependent rollups. null ⇒ unbounded (the pre-1.6.8 behaviour). The effective cap combines this with the host StreamData:Recompute:MaxRetroactiveReachHardLimitMs ceiling. Only bounds the automatic path; manual recomputeArchive / rewindRollupWatermark stay unbounded.

public Nullable<long> MaxRetroactiveReachMs { get; set; }

Property Value​

Nullable<Int64>

ConflictPrecedence​

Opt-in conflict resolution: the ordered keys that decide which of two competing writes to the same archive row survives. Empty (the default) keeps the historical last-write-wins upsert, where a re-delivered or out-of-order data point overwrites whatever is stored and the stored value therefore reflects arrival order rather than the data.

public IReadOnlyList<ArchiveConflictKey> ConflictPrecedence { get; set; }

Property Value​

IReadOnlyList<ArchiveConflictKey>

Remarks:

Keys are compared lexicographically in declaration order: the first decides, a later one only breaks a tie in every key before it. That is a total order over the data itself, so the surviving value is its maximum — the same value whichever write lands first. Delivery order stops mattering rather than merely being satisfied, which is the difference between this and sorting the producer.

The guarantee covers writes the keys tell apart. Two writes that are equal in every key are not ordered by them: the last key admits equality, so the later write replaces the stored row. That keeps an identical re-delivery an idempotent upsert and lets rows without keys behave as they did before the archive opted in. Declare enough keys to distinguish every pair of writes that can carry different values.

A stored row whose key is null is always replaceable (rows written before the archive opted in carry none); an incoming null key never displaces a stored non-null one.

Constructors​

ArchiveSnapshot(OctoObjectId, RtCkId<CkTypeId>, CkArchiveStatus, String, IReadOnlyList<CkArchiveColumnSpec>)​

Read-only snapshot of the parts of a CkArchive entity the lifecycle service needs. Intentionally narrower than the full RtEntity: the lifecycle decisions only depend on ArchiveSnapshot.Status plus identification fields. Backend-specific stores translate from their concrete representation to this record. Columns carries the user-configured archive columns (path/indexed/required) the data-store provider needs to generate DDL — empty when the archive only has the standard time-series columns.

public ArchiveSnapshot(OctoObjectId RtId, RtCkId<CkTypeId> TargetCkTypeId, CkArchiveStatus Status, string RtWellKnownName, IReadOnlyList<CkArchiveColumnSpec> Columns)

Parameters​

RtId OctoObjectId

TargetCkTypeId RtCkId<CkTypeId>

Status CkArchiveStatus

RtWellKnownName String

Columns IReadOnlyList<CkArchiveColumnSpec>