using ZB.MOM.WW.OtOpcUa.Runtime.DataConnections; namespace ZB.MOM.WW.OtOpcUa.Host.Configuration; /// Observes the committed provisioning state without exposing secret or trust material. public sealed class DataConnectionBundleCommitObserver(DataConnectionSecretProvisioner credentials, DataConnectionTrustPolicyStore trust) : IDataConnectionBundleCommitObserver { /// public async Task ObserveAsync(string connectionId, CancellationToken cancellationToken) { ArgumentException.ThrowIfNullOrWhiteSpace(connectionId); await DataConnectionSecretProvisioner.Gate.WaitAsync(cancellationToken).ConfigureAwait(false); try { var credential = await credentials.ObserveCommittedLockedAsync(connectionId, cancellationToken).ConfigureAwait(false); var trustState = await trust.ObserveCommittedLockedAsync(connectionId, cancellationToken).ConfigureAwait(false); return new(credential.Scope, credential.Version, credential.Deleted, trustState.Scope, trustState.Version, trustState.Retired); } finally { DataConnectionSecretProvisioner.Gate.Release(); } } }