using ZB.MOM.WW.OtOpcUa.Core.AlarmHistorian; namespace ZB.MOM.WW.OtOpcUa.Admin.Services; /// /// Surfaces the local-node historian queue health on the Admin UI's /// /alarms/historian diagnostics page (Phase 7 plan decisions #16/#21). /// Exposes queue depth / drain state / last-error, and lets the operator retry /// dead-lettered rows without restarting the node. /// /// /// The sink injected here is the server-process . /// When is bound (historian disabled for this /// deployment), silently returns 0 and /// reports . /// public sealed class HistorianDiagnosticsService(IAlarmHistorianSink sink) { public HistorianSinkStatus GetStatus() => sink.GetStatus(); /// /// Operator action from the UI's "Retry dead-lettered" button. Returns the number /// of rows revived so the UI can flash a confirmation. When the live sink doesn't /// implement retry (test doubles, Null sink), returns 0. /// public int TryRetryDeadLettered() { if (sink is SqliteStoreAndForwardSink concrete) return concrete.RetryDeadLettered(); return 0; } }