- WP-1: Site cluster config (keep-oldest SBR, down-if-alone, 2s/10s failure detection) - WP-2: Site-role host bootstrap (no Kestrel, SQLite paths) - WP-3: SiteStorageService with deployed_configurations + static_attribute_overrides tables - WP-4: DeploymentManagerActor as cluster singleton with staggered Instance Actor creation, OneForOneStrategy/Resume supervision, deploy/disable/enable/delete lifecycle - WP-5: InstanceActor with attribute state, GetAttribute/SetAttribute, SQLite override persistence - WP-6: CoordinatedShutdown verified for graceful singleton handover - WP-7: Dual-node recovery (both seed nodes, min-nr-of-members=1) - WP-8: 31 tests (storage CRUD, actor lifecycle, supervision, negative checks) 389 total tests pass, zero warnings.
25 lines
662 B
C#
25 lines
662 B
C#
using Microsoft.Extensions.Hosting;
|
|
|
|
namespace ScadaLink.SiteRuntime.Persistence;
|
|
|
|
/// <summary>
|
|
/// Hosted service that initializes the SQLite schema on startup.
|
|
/// Runs before the Akka actor system starts creating actors.
|
|
/// </summary>
|
|
public class SiteStorageInitializer : IHostedService
|
|
{
|
|
private readonly SiteStorageService _storage;
|
|
|
|
public SiteStorageInitializer(SiteStorageService storage)
|
|
{
|
|
_storage = storage;
|
|
}
|
|
|
|
public async Task StartAsync(CancellationToken cancellationToken)
|
|
{
|
|
await _storage.InitializeAsync();
|
|
}
|
|
|
|
public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask;
|
|
}
|