Phase 3B: Site I/O & Observability — Communication, DCL, Script/Alarm actors, Health, Event Logging
Communication Layer (WP-1–5): - 8 message patterns with correlation IDs, per-pattern timeouts - Central/Site communication actors, transport heartbeat config - Connection failure handling (no central buffering, debug streams killed) Data Connection Layer (WP-6–14, WP-34): - Connection actor with Become/Stash lifecycle (Connecting/Connected/Reconnecting) - OPC UA + LmxProxy adapters behind IDataConnection - Auto-reconnect, bad quality propagation, transparent re-subscribe - Write-back, tag path resolution with retry, health reporting - Protocol extensibility via DataConnectionFactory Site Runtime (WP-15–25, WP-32–33): - ScriptActor/ScriptExecutionActor (triggers, concurrent execution, blocking I/O dispatcher) - AlarmActor/AlarmExecutionActor (ValueMatch/RangeViolation/RateOfChange, in-memory state) - SharedScriptLibrary (inline execution), ScriptRuntimeContext (API) - ScriptCompilationService (Roslyn, forbidden API enforcement, execution timeout) - Recursion limit (default 10), call direction enforcement - SiteStreamManager (per-subscriber bounded buffers, fire-and-forget) - Debug view backend (snapshot + stream), concurrency serialization - Local artifact storage (4 SQLite tables) Health Monitoring (WP-26–28): - SiteHealthCollector (thread-safe counters, connection state) - HealthReportSender (30s interval, monotonic sequence numbers) - CentralHealthAggregator (offline detection 60s, online recovery) Site Event Logging (WP-29–31): - SiteEventLogger (SQLite, 6 event categories, ISO 8601 UTC) - EventLogPurgeService (30-day retention, 1GB cap) - EventLogQueryService (filters, keyword search, keyset pagination) 541 tests pass, zero warnings.
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
using ScadaLink.Commons.Types.Enums;
|
||||
|
||||
namespace ScadaLink.Commons.Messages.DataConnection;
|
||||
|
||||
/// <summary>
|
||||
/// Health metrics for a single data connection, contributed to the site health report.
|
||||
/// </summary>
|
||||
public record DataConnectionHealthReport(
|
||||
string ConnectionName,
|
||||
ConnectionHealth Status,
|
||||
int TotalSubscribedTags,
|
||||
int ResolvedTags,
|
||||
DateTimeOffset Timestamp);
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace ScadaLink.Commons.Messages.DataConnection;
|
||||
|
||||
/// <summary>
|
||||
/// Request from an Instance Actor to subscribe to tag values through the DCL.
|
||||
/// </summary>
|
||||
public record SubscribeTagsRequest(
|
||||
string CorrelationId,
|
||||
string InstanceUniqueName,
|
||||
string ConnectionName,
|
||||
IReadOnlyList<string> TagPaths,
|
||||
DateTimeOffset Timestamp);
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace ScadaLink.Commons.Messages.DataConnection;
|
||||
|
||||
/// <summary>
|
||||
/// Response confirming tag subscription registration.
|
||||
/// </summary>
|
||||
public record SubscribeTagsResponse(
|
||||
string CorrelationId,
|
||||
string InstanceUniqueName,
|
||||
bool Success,
|
||||
string? ErrorMessage,
|
||||
DateTimeOffset Timestamp);
|
||||
@@ -0,0 +1,21 @@
|
||||
using ScadaLink.Commons.Interfaces.Protocol;
|
||||
|
||||
namespace ScadaLink.Commons.Messages.DataConnection;
|
||||
|
||||
/// <summary>
|
||||
/// Published by DCL to an Instance Actor when a subscribed tag value changes.
|
||||
/// </summary>
|
||||
public record TagValueUpdate(
|
||||
string ConnectionName,
|
||||
string TagPath,
|
||||
object? Value,
|
||||
QualityCode Quality,
|
||||
DateTimeOffset Timestamp);
|
||||
|
||||
/// <summary>
|
||||
/// Published by DCL when connection state changes, causing bulk quality updates.
|
||||
/// </summary>
|
||||
public record ConnectionQualityChanged(
|
||||
string ConnectionName,
|
||||
QualityCode Quality,
|
||||
DateTimeOffset Timestamp);
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace ScadaLink.Commons.Messages.DataConnection;
|
||||
|
||||
/// <summary>
|
||||
/// Request from an Instance Actor to unsubscribe from all its tags when stopping.
|
||||
/// </summary>
|
||||
public record UnsubscribeTagsRequest(
|
||||
string CorrelationId,
|
||||
string InstanceUniqueName,
|
||||
string ConnectionName,
|
||||
DateTimeOffset Timestamp);
|
||||
@@ -0,0 +1,21 @@
|
||||
namespace ScadaLink.Commons.Messages.DataConnection;
|
||||
|
||||
/// <summary>
|
||||
/// Request to write a value to a device tag through the DCL.
|
||||
/// Write failures are returned synchronously to the calling script.
|
||||
/// </summary>
|
||||
public record WriteTagRequest(
|
||||
string CorrelationId,
|
||||
string ConnectionName,
|
||||
string TagPath,
|
||||
object? Value,
|
||||
DateTimeOffset Timestamp);
|
||||
|
||||
/// <summary>
|
||||
/// Response for a device tag write operation.
|
||||
/// </summary>
|
||||
public record WriteTagResponse(
|
||||
string CorrelationId,
|
||||
bool Success,
|
||||
string? ErrorMessage,
|
||||
DateTimeOffset Timestamp);
|
||||
Reference in New Issue
Block a user