feat(grpc-data): X0 review - tolerate any unknown bit at the artifact/catalog seam; drop diagnostics for exports and mappings
- ValidateDeployed ignores every bit outside Understood (understood subset still validated); P02's two 1<<30 rows become 'tolerated, grants nothing'. - UnknownOperationDrops: Warning + counter tagged kind=connection|export|mapping, counted once per row per accepted artifact change; collected under each lock, logged after release. Mappings masked at Stage. - Surfaced via DataConnectionDiagnosticsSnapshot (DroppedUnknownOperations, MappingsWithDroppedOperations) and NodeDiagnosticsSnapshot.DroppedExportOperations. - End-to-end test: 1<<30 through parse -> catalog compile -> mapping stage -> runtime apply. - DataConnectionProtoContract.Validate() now runs at AddOtOpcUaDataConnections.
This commit is contained in:
@@ -33,6 +33,8 @@ public static class DataConnectionRegistration
|
||||
services.AddSingleton<IValidateOptions<DataConnectionOptions>>(new DataConnectionOptionsValidator(environment));
|
||||
if (!options.Enabled) return options;
|
||||
if (!hasDriver) throw new InvalidOperationException("DataConnections requires this node's driver role.");
|
||||
// Fail host start on a wire-contract drift (frozen field numbers and the X0 reservations); a descriptor walk, cheap.
|
||||
ZB.MOM.WW.OtOpcUa.Commons.Protos.DataConnectionProtoContract.Validate();
|
||||
|
||||
services.TryAddSingleton<TimeProvider>(TimeProvider.System);
|
||||
services.TryAddSingleton<DataWriteDispatchFence>();
|
||||
@@ -56,7 +58,7 @@ public static class DataConnectionRegistration
|
||||
var state = CaptureReadRole(role, warm);
|
||||
var servingRole = settings.IsWarm && state.WarmRole != WarmRole.Active ? "Standby" : state.Role;
|
||||
return new(identity.NodeId, identity.Incarnation, servingRole, 0, 0, state.Generation);
|
||||
});
|
||||
}) { Logger = LoggerFor<LocalCatalogCoordinator>(sp) };
|
||||
});
|
||||
services.AddSingleton(sp => new PartitionedSampleHub(options.Hub, sp.GetRequiredService<TimeProvider>()));
|
||||
services.AddSingleton(sp => new SourceSamplePublisher(sp.GetRequiredService<PartitionedSampleHub>(),
|
||||
@@ -72,7 +74,8 @@ public static class DataConnectionRegistration
|
||||
sp.GetRequiredService<BrowseContinuationRegistry>(), sp.GetRequiredService<IGrpcDataAdapterConnectionSource>(),
|
||||
sp.GetRequiredService<DataOperationPolicy>(), 256, options.MaxConcurrentCalls));
|
||||
services.AddSingleton<IFederatedProjectionCatalog>(sp => sp.GetRequiredService<RemoteNamespaceResolver>());
|
||||
services.AddSingleton<ProjectedMappingDeploymentRuntime>();
|
||||
services.AddSingleton(sp => new ProjectedMappingDeploymentRuntime(sp.GetRequiredService<LocalCatalogCoordinator>(),
|
||||
sp.GetRequiredService<RemoteNamespaceResolver>()) { Logger = LoggerFor<ProjectedMappingDeploymentRuntime>(sp) });
|
||||
services.TryAddSingleton<DeferredAddressSpaceSink>();
|
||||
services.AddSingleton<DeferredProjectedNodeAccess>();
|
||||
services.AddSingleton<IProjectedNodeLookup>(sp => sp.GetRequiredService<DeferredProjectedNodeAccess>());
|
||||
@@ -214,8 +217,7 @@ public static class DataConnectionRegistration
|
||||
return new DataConnectionConsumerRoleSnapshot(mode, eligible, state.Generation);
|
||||
})
|
||||
{
|
||||
Logger = (Microsoft.Extensions.Logging.ILogger?)sp.GetService<Microsoft.Extensions.Logging.ILoggerFactory>()?.CreateLogger<DataConnectionDeploymentRuntime>()
|
||||
?? Microsoft.Extensions.Logging.Abstractions.NullLogger.Instance,
|
||||
Logger = LoggerFor<DataConnectionDeploymentRuntime>(sp),
|
||||
};
|
||||
return runtime;
|
||||
});
|
||||
@@ -237,6 +239,9 @@ public static class DataConnectionRegistration
|
||||
return options;
|
||||
}
|
||||
|
||||
private static Microsoft.Extensions.Logging.ILogger LoggerFor<T>(IServiceProvider sp) =>
|
||||
(Microsoft.Extensions.Logging.ILogger?)sp.GetService<Microsoft.Extensions.Logging.ILoggerFactory>()?.CreateLogger<T>()
|
||||
?? Microsoft.Extensions.Logging.Abstractions.NullLogger.Instance;
|
||||
private static (string Role, long Generation, WarmRole? WarmRole, long ReadEpoch) CaptureReadRole(
|
||||
RedundancyRoleView role, DataConnectionWarmRoleView warm)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user