Files
ScadaBridge/src/ZB.MOM.WW.ScadaBridge.CentralUI/Services/IConnectionHealthQueryService.cs
T
Joseph Doherty 3ae3f1bcef refactor(health): move ICentralHealthAggregator and SiteHealthState to Commons (ScadaBridge#71)
Interface goes to Commons.Interfaces.Services and the state record to
Commons.Messages.Health, so CentralCommunicationActor no longer needs the
HealthMonitoring namespace. Implementation stays in HealthMonitoring.

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
2026-11-09 13:05:48 -05:00

29 lines
1.5 KiB
C#

using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Services;
using ZB.MOM.WW.ScadaBridge.Commons.Types.Enums;
namespace ZB.MOM.WW.ScadaBridge.CentralUI.Services;
/// <summary>
/// CentralUI facade that projects the per-site health reports' name-keyed
/// connection statuses onto a connection-id → <see cref="ConnectionHealth"/> map for
/// the design DataConnections page. Reuses the existing health transport — the
/// <see cref="ZB.MOM.WW.ScadaBridge.HealthMonitoring.ICentralHealthAggregator"/>'s
/// already-aggregated <c>SiteHealthReport.DataConnectionStatuses</c> — and resolves
/// each report's connection NAME key back to a <c>DataConnection.Id</c> within the
/// report's own site, so the page can render a live badge per connection node.
/// </summary>
public interface IConnectionHealthQueryService
{
/// <summary>
/// Returns a snapshot of connection-id → latest known <see cref="ConnectionHealth"/>
/// across every configured site. A site with no health report yet (or a
/// heartbeat-only state) contributes no entries; a report referencing a
/// connection name that does not match any configured connection is skipped.
/// Callers treat a missing key as "unknown" rather than a failure.
/// </summary>
/// <param name="ct">Cancellation token.</param>
/// <returns>A task resolving to the connection-id → health map.</returns>
Task<IReadOnlyDictionary<int, ConnectionHealth>> GetConnectionHealthAsync(
CancellationToken ct = default);
}