feat(adminui): IFleetDiagnosticsClient skeleton (Akka round-trip tracked as F17)

This commit is contained in:
Joseph Doherty
2026-05-26 05:17:59 -04:00
parent f022499e7f
commit b83f099394

View File

@@ -0,0 +1,36 @@
using Akka.Actor;
using ZB.MOM.WW.OtOpcUa.Commons.Interfaces;
using ZB.MOM.WW.OtOpcUa.Commons.Types;
namespace ZB.MOM.WW.OtOpcUa.AdminUI.Clients;
/// <summary>
/// <see cref="IFleetDiagnosticsClient"/> that targets a named node's <c>DriverHostActor</c> over
/// Akka cluster <see cref="ActorSelection"/>.
///
/// The actual <c>GetDiagnosticsRequest</c>/<c>NodeDiagnosticsSnapshot</c> round-trip on the
/// driver side is staged for follow-up F17 (depends on DriverHostActor exposing the request
/// handler; right now it only handles DispatchDeployment). For now the client returns an empty
/// snapshot so the UI can render a "no data yet" state.
/// </summary>
public sealed class FleetDiagnosticsClient : IFleetDiagnosticsClient
{
private readonly ActorSystem _system;
public FleetDiagnosticsClient(ActorSystem system)
{
_system = system;
}
public Task<NodeDiagnosticsSnapshot> GetDiagnosticsAsync(NodeId nodeId, CancellationToken ct)
{
// F17: ActorSelection at $"akka.tcp://{system}@{nodeId.Value}:4053/user/driver-host"
// → Ask<NodeDiagnosticsSnapshot>(new GetDiagnostics(), timeout).
var snapshot = new NodeDiagnosticsSnapshot(
nodeId,
CurrentRevision: null,
Drivers: Array.Empty<DriverInstanceDiagnostics>(),
AsOfUtc: DateTime.UtcNow);
return Task.FromResult(snapshot);
}
}