Publish runtime sessions as typed state

This commit is contained in:
Meta Vens 2026-06-14 12:31:20 +01:00
commit 5c19d515f0
10 changed files with 145 additions and 28 deletions

View file

@ -17,6 +17,14 @@ var evePendingBefore = CountPendingEveCommands(statePath);
var now = DateTimeOffset.UtcNow.ToString("O");
await using var node = await AetheriaStateNode.OpenAsync(statePath, runtimeId);
await node.PutRuntimeSessionAsync(new AetheriaRuntimeSession
{
RuntimeId = runtimeId,
Role = "pending-drain",
StartedAtUtc = now,
LastSeenAtUtc = now,
Status = "running"
});
var report = await AetheriaRuntimeCommitLogApplier.ApplyPendingAsync(node, deleteApplied);
var eveReport = await AetheriaEveCommandBridge.ApplyPendingAsync(node, deleteApplied);
var commitStatus = new AetheriaRuntimeCommitDrainStatus
@ -49,7 +57,16 @@ var eveStatus = new AetheriaEveCommandDrainStatus
};
await node.PutRuntimeCommitDrainStatusAsync(commitStatus);
await node.PutEveCommandDrainStatusAsync(eveStatus);
await node.PutOperationsSurfaceAsync(AetheriaOperationsSurfaceProjector.Build(commitStatus, eveStatus));
var completedSession = new AetheriaRuntimeSession
{
RuntimeId = runtimeId,
Role = "pending-drain",
StartedAtUtc = now,
LastSeenAtUtc = DateTimeOffset.UtcNow.ToString("O"),
Status = "completed"
};
await node.PutRuntimeSessionAsync(completedSession);
await node.PutOperationsSurfaceAsync(AetheriaOperationsSurfaceProjector.Build(commitStatus, eveStatus, completedSession));
await node.PutProviderAdvertisementAsync(AetheriaProviderAdvertisementProjector.Build(statePath, now));
await node.FlushAsync();