feat: author and inspect grpc data connections

This commit is contained in:
Joseph Doherty
2026-11-16 20:58:43 -05:00
parent 8ad03e9c5d
commit 1df29a3124
31 changed files with 1246 additions and 141 deletions
@@ -72,6 +72,24 @@ public sealed class DataConnectionDeploymentRuntime : IAsyncDisposable
/// <summary>Configured redundancy mode from the current validated artifact.</summary>
public RedundancyMode CurrentConsumerMode { get { lock (_sync) return _desired?.ConsumerMode ?? RedundancyMode.None; } }
/// <summary>Captures only this node's applied scope and current transport evidence.</summary>
public IReadOnlyList<ZB.MOM.WW.OtOpcUa.Commons.Interfaces.DataConnectionDiagnosticsSnapshot> CaptureDiagnostics(IReadOnlyDictionary<string, int>? retainedSourceCounts = null)
{
lock (_sync)
{
if (_disposed || _desired is not { } desired) return [];
return desired.Specs.Values.Select(spec =>
{
if (!_attemptPending && _scopeReady && _entries.TryGetValue(spec.Id, out var entry) && entry.Ready)
return entry.Connection.CaptureDiagnostics(spec.Revision, desired.ScopeVersion, desired.ArtifactRevision) with
{ SourceCount = retainedSourceCounts is null ? null : retainedSourceCounts.TryGetValue(spec.Id, out var count) ? count : 0 };
return new ZB.MOM.WW.OtOpcUa.Commons.Interfaces.DataConnectionDiagnosticsSnapshot(spec.Id, spec.Revision,
_attemptPending ? "connecting" : _retryNotBefore > _clock.GetTimestamp() ? "backoff" : "connecting",
null, null, 0, 0, desired.ScopeVersion, desired.ArtifactRevision, _clock.GetUtcNow().UtcDateTime);
}).ToArray();
}
}
/// <summary>Withdraws current routes before parsing or staging a different artifact.</summary>
public void BeginAttempt(string artifactRevision)
{