wip(processing): analysis and render job handlers, render node client (interrupted)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-02 16:33:27 +00:00
1 parent f4e2f285a9
commit fee198f627
30 files changed
+2262 -21

No files matched your search

@@ -0,0 +1,40 @@
namespace Titano.Data.Processing;
/// <summary>
/// Delivers the synchronous progress reports of the engine (analysis, render stages) to an asynchronous sink (job
/// context, render-node protocol) one after the other, in report order. Await <see cref="FlushAsync"/> before a
/// checkpoint or the end of the work to observe the deliveries.
/// </summary>
internal sealed class ProgressChain(Func<long, long, string?, ValueTask> sink)
{
private readonly Lock _gate = new();
private Task _pending = Task.CompletedTask;
/// <summary>A progress receiver mapping its reports to done, total and message.</summary>
public IProgress<T> For<T>(Func<T, (long Done, long Total, string? Message)> map) => new Forward<T>(this, map);
public Task FlushAsync()
{
lock (_gate) return _pending;
}
private void Post(long done, long total, string? message)
{
lock (_gate) _pending = AfterAsync(_pending, done, total, message);
}
private async Task AfterAsync(Task previous, long done, long total, string? message)
{
await previous.ConfigureAwait(false);
await sink(done, total, message).ConfigureAwait(false);
}
private sealed class Forward<T>(ProgressChain chain, Func<T, (long Done, long Total, string? Message)> map) : IProgress<T>
{
public void Report(T value)
{
var (done, total, message) = map(value);
chain.Post(done, total, message);
}
}
}