using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Options;
namespace ZB.MOM.WW.ScadaBridge.ClusterInfrastructure;
///
/// DI registration for the Cluster Infrastructure component.
///
public static class ServiceCollectionExtensions
{
///
/// Registers the Cluster Infrastructure services. This component owns the
/// cluster configuration contract (); the
/// Akka.NET bootstrap itself lives in ZB.MOM.WW.ScadaBridge.Host
/// (see Component-ClusterInfrastructure.md).
///
/// Registering the means a misconfigured
/// ScadaBridge:Cluster section (e.g. MinNrOfMembers: 2 or a quorum
/// split-brain strategy) throws an the
/// first time is resolved, rather than booting
/// into a broken cluster.
///
///
/// The service collection to register into.
/// The same instance, for call chaining.
public static IServiceCollection AddClusterInfrastructure(this IServiceCollection services)
{
services.TryAddEnumerable(
ServiceDescriptor.Singleton, ClusterOptionsValidator>());
return services;
}
// ClusterInfra-014: the previous `AddClusterInfrastructureActors` extension
// was dead surface — its XML doc told callers "do not call", its body
// unconditionally threw `NotImplementedException`, and no production caller
// existed anywhere in the solution (verified by grep). The CI-002
// "throw loudly" decision was made while CI-001's ownership question was
// still open; that question is now permanently settled by the
// "Implementation Note — Code Placement" section of
// Component-ClusterInfrastructure.md, which records that all actor wiring
// lives in ZB.MOM.WW.ScadaBridge.Host (AkkaHostedService). Keeping a public extension
// method that exists only to throw was API-surface noise that an IDE would
// still suggest via auto-complete, so the method and its companion
// `AddClusterInfrastructureActors_ThrowsRatherThanSilentlySucceeding` test
// were both removed.
}