9cff87fe85
Remove project bookkeeping citations from shipped code comments across the solution: hyphenated task IDs (WP-14, StoreAndForward-025), milestone/task/ issue refs (M3, Task 4, Audit Log #23, #21), Bundle X task-bundle labels, and C/D/K/S/T phase labels. Comment text only — no code logic, string/log literals, or XML-doc structure changed. Genuine descriptions are preserved (only the citation is stripped), and technical lookalikes are retained (UTF-8, SHA-256, T00:00:00, M365, UTC-5, pre-C4/pre-C5 schema versions). Flagged by the new CommentChecker TaskReferenceInComment / TrackingReferenceInComment checks plus targeted grep passes; full solution builds clean, append-only guard tests pass.
65 lines
3.3 KiB
C#
65 lines
3.3 KiB
C#
using Microsoft.Extensions.DependencyInjection;
|
|
using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Transport;
|
|
|
|
namespace ZB.MOM.WW.ScadaBridge.DeploymentManager;
|
|
|
|
public static class ServiceCollectionExtensions
|
|
{
|
|
/// <summary>
|
|
/// Configuration section that <see cref="DeploymentManagerOptions"/> is bound to.
|
|
/// The Host binds this section to <c>appsettings.json</c> (see
|
|
/// <c>Program.cs</c>); component libraries do not depend on
|
|
/// <c>IConfiguration</c> directly, consistent with the Options-pattern
|
|
/// convention enforced by <c>OptionsTests</c>.
|
|
/// </summary>
|
|
public const string OptionsSection = "ScadaBridge:DeploymentManager";
|
|
|
|
/// <summary>
|
|
/// Registers the Deployment Manager services. <see cref="DeploymentManagerOptions"/>
|
|
/// is registered via <see cref="OptionsServiceCollectionExtensions.AddOptions"/> so
|
|
/// <c>IOptions<DeploymentManagerOptions></c> is always resolvable; the Host
|
|
/// binds <see cref="OptionsSection"/> to configuration so the operation-lock and
|
|
/// artifact-deployment timeouts are tunable via <c>appsettings.json</c>.
|
|
/// </summary>
|
|
/// <param name="services">The service collection to register into.</param>
|
|
/// <returns>The <paramref name="services"/> instance for chaining.</returns>
|
|
public static IServiceCollection AddDeploymentManager(this IServiceCollection services)
|
|
{
|
|
// Ensure the options class is always resolvable.
|
|
// The Host binds OptionsSection to appsettings.json; absent that binding
|
|
// the declared option-class defaults apply.
|
|
services.AddOptions<DeploymentManagerOptions>();
|
|
services.AddSingleton<OperationLockManager>();
|
|
|
|
// Push-based deployment-status notification. Registered
|
|
// as a singleton so the scoped DeploymentService and the Central UI's
|
|
// scoped Blazor page component share one instance — both run in the
|
|
// same central Host process. The deployment-status page subscribes to
|
|
// it instead of polling the database every 10 seconds.
|
|
services.AddSingleton<IDeploymentStatusNotifier, DeploymentStatusNotifier>();
|
|
|
|
services.AddScoped<IFlatteningPipeline, FlatteningPipeline>();
|
|
services.AddScoped<DeploymentService>();
|
|
services.AddScoped<ArtifactDeploymentService>();
|
|
|
|
// Expose the flattening pipeline's revision-hash computation
|
|
// to the Transport bundle importer through the Commons IStaleInstanceProbe
|
|
// seam, so a template overwrite can enumerate the deployed instances whose
|
|
// flattened config has drifted from their deployed snapshot. Scoped so it
|
|
// shares the per-request DbContext with the in-flight import.
|
|
services.AddScoped<IStaleInstanceProbe, StaleInstanceProbe>();
|
|
return services;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Registers Deployment Manager Akka actor bindings. Actor creation is handled by the Host during actor system startup.
|
|
/// </summary>
|
|
/// <param name="services">The service collection to register into.</param>
|
|
/// <returns>The <paramref name="services"/> instance for chaining.</returns>
|
|
public static IServiceCollection AddDeploymentManagerActors(this IServiceCollection services)
|
|
{
|
|
// Akka actor registration is handled by Host component during actor system startup
|
|
return services;
|
|
}
|
|
}
|