Joseph Doherty
|
25ad4b1929
|
Phase 7 Stream D — Historian alarm sink (SQLite store-and-forward + Galaxy.Host IPC contracts)
Phase 7 plan decisions #16, #17, #19, #21 implementation. Durable local SQLite queue
absorbs every qualifying alarm event; drain worker forwards batches to Galaxy.Host
(reusing the already-loaded 32-bit aahClientManaged DLLs) on an exponential-backoff
cadence; operator acks never block on the historian being reachable.
## New project Core.AlarmHistorian (net10)
- AlarmHistorianEvent — source-agnostic event shape (scripted alarms + Galaxy-native +
AB CIP ALMD + any future IAlarmSource)
- IAlarmHistorianSink / NullAlarmHistorianSink — interface + disabled default
- IAlarmHistorianWriter — per-event outcome (Ack / RetryPlease / PermanentFail); Stream G
wires the Galaxy.Host IPC client implementation
- SqliteStoreAndForwardSink — full implementation:
- Queue table with AttemptCount / LastError / DeadLettered columns
- DrainOnceAsync serialised via SemaphoreSlim
- BackoffLadder 1s → 2s → 5s → 15s → 60s (cap)
- DefaultCapacity 1,000,000 rows — overflow evicts oldest non-dead-lettered
- DefaultDeadLetterRetention 30 days — sweeper purges on every drain tick
- RetryDeadLettered operator action reattaches dead-letters to the regular queue
- Writer-side exceptions treated as whole-batch RetryPlease (no data loss)
## New IPC contracts in Driver.Galaxy.Shared
- HistorianAlarmEventRequest — batched up to 100 events/request per plan Stream D.5
- HistorianAlarmEventResponse — per-event outcome (1:1 with request order)
- HistorianAlarmEventOutcomeDto enum (byte on the wire — Ack/RetryPlease/PermanentFail)
- HistorianAlarmEventDto — mirrors Core.AlarmHistorian.AlarmHistorianEvent
- HistorianConnectivityStatusNotification — Host pushes proactively when the SDK
session drops so /alarms/historian flips red without waiting for the next drain
- MessageKind additions: 0x80 HistorianAlarmEventRequest / 0x81 HistorianAlarmEventResponse
/ 0x82 HistorianConnectivityStatus
## Tests — 14/14
SqliteStoreAndForwardSinkTests covers: enqueue→drain→Ack round-trip, empty-queue no-op,
RetryPlease bumps backoff + keeps row, Ack after Retry resets backoff, PermanentFail
dead-letters one row without blocking neighbors, writer exception treated as whole-batch
retry with error surfaced in status, capacity eviction drops oldest non-dead-lettered,
dead-letters purged past retention window, RetryDeadLettered requeues, ladder caps at
60s after 10 retries, Null sink reports Disabled status, null sink swallows enqueue,
ctor argument validation, disposed sink rejects enqueue.
## Totals
Full Phase 7 tests: 160 green (63 Scripting + 36 VirtualTags + 47 ScriptedAlarms +
14 AlarmHistorian). Stream G wires this into the real Galaxy.Host IPC pipe.
|
2026-04-20 19:11:17 -04:00 |
|