feat(commons): add cluster/admin/diagnostics client interfaces
This commit is contained in:
@@ -0,0 +1,13 @@
|
|||||||
|
using ZB.MOM.WW.OtOpcUa.Commons.Messages.Admin;
|
||||||
|
|
||||||
|
namespace ZB.MOM.WW.OtOpcUa.Commons.Interfaces;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cluster-singleton-proxy client for the <c>AdminOperationsActor</c>. The Blazor UI calls
|
||||||
|
/// this from any host (admin or driver role); the proxy routes the request to whichever node
|
||||||
|
/// holds the admin singleton.
|
||||||
|
/// </summary>
|
||||||
|
public interface IAdminOperationsClient
|
||||||
|
{
|
||||||
|
Task<StartDeploymentResult> StartDeploymentAsync(string createdBy, CancellationToken ct);
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
using ZB.MOM.WW.OtOpcUa.Commons.Types;
|
||||||
|
|
||||||
|
namespace ZB.MOM.WW.OtOpcUa.Commons.Interfaces;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Live view of the local node's identity and the cluster's role topology. Implemented by
|
||||||
|
/// <c>ClusterRoleInfo</c> in <c>OtOpcUa.Cluster</c>; consumed by everything that needs to
|
||||||
|
/// distinguish admin-role vs driver-role members or react to role-leader changes (e.g. OPC UA
|
||||||
|
/// ServiceLevel computation).
|
||||||
|
/// </summary>
|
||||||
|
public interface IClusterRoleInfo
|
||||||
|
{
|
||||||
|
NodeId LocalNode { get; }
|
||||||
|
IReadOnlySet<string> LocalRoles { get; }
|
||||||
|
bool HasRole(string role);
|
||||||
|
IReadOnlyList<NodeId> MembersWithRole(string role);
|
||||||
|
NodeId? RoleLeader(string role);
|
||||||
|
|
||||||
|
event EventHandler<RoleLeaderChangedEventArgs>? RoleLeaderChanged;
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using ZB.MOM.WW.OtOpcUa.Commons.Types;
|
||||||
|
|
||||||
|
namespace ZB.MOM.WW.OtOpcUa.Commons.Interfaces;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Per-node diagnostics fetched on demand. Implemented in Phase 8 (AdminUI/Runtime wiring)
|
||||||
|
/// over an Akka request/response — the diagnostics actor lives on the target driver node.
|
||||||
|
/// </summary>
|
||||||
|
public interface IFleetDiagnosticsClient
|
||||||
|
{
|
||||||
|
Task<NodeDiagnosticsSnapshot> GetDiagnosticsAsync(NodeId nodeId, CancellationToken ct);
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using ZB.MOM.WW.OtOpcUa.Commons.Types;
|
||||||
|
|
||||||
|
namespace ZB.MOM.WW.OtOpcUa.Commons.Interfaces;
|
||||||
|
|
||||||
|
public sealed record DriverInstanceDiagnostics(
|
||||||
|
Guid DriverInstanceId,
|
||||||
|
string Name,
|
||||||
|
string State,
|
||||||
|
int ConnectedDevices,
|
||||||
|
int FaultedDevices,
|
||||||
|
DateTime LastChangeUtc);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Per-node diagnostics returned by <c>IFleetDiagnosticsClient</c>. Populated by the node's
|
||||||
|
/// local <c>DriverHostActor</c> via a request/response over Akka.
|
||||||
|
/// </summary>
|
||||||
|
public sealed record NodeDiagnosticsSnapshot(
|
||||||
|
NodeId NodeId,
|
||||||
|
RevisionHash? CurrentRevision,
|
||||||
|
IReadOnlyList<DriverInstanceDiagnostics> Drivers,
|
||||||
|
DateTime AsOfUtc);
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using ZB.MOM.WW.OtOpcUa.Commons.Types;
|
||||||
|
|
||||||
|
namespace ZB.MOM.WW.OtOpcUa.Commons.Interfaces;
|
||||||
|
|
||||||
|
public sealed class RoleLeaderChangedEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
public required string Role { get; init; }
|
||||||
|
public required NodeId? PreviousLeader { get; init; }
|
||||||
|
public required NodeId? NewLeader { get; init; }
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user