Merge branch 'fix/ingest-upload': uploads into API-made sequences, damaged frames repaired, positions follow inserts, cardEvent
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
29 files changed
+1546
-80
No files matched your search
@@ -192,6 +192,13 @@ public sealed class TitanoClient : IDisposable
|
||||
return await RetryAsync(() => SendAsync<CompleteUploadResponse>(HttpMethod.Post, $"api/v1/uploads/{uploadId}/complete", ProtocolJson.Default.CompleteUploadResponse, ct), ct).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reports a card import this client streams into the server (started, progress, finished); the server tells every
|
||||
/// connected client with a <see cref="CardEvent"/> (BRIEF §14.3).
|
||||
/// </summary>
|
||||
public Task ReportCardAsync(CardImportReport report, CancellationToken ct = default) =>
|
||||
SendAsync(HttpMethod.Post, "api/v1/uploads/cards", report, ProtocolJson.Default.CardImportReport, ct);
|
||||
|
||||
/// <summary>
|
||||
/// Render node: uploads the output of a claimed job in resumable chunks, then completes the job; the server verifies
|
||||
/// the SHA-256 in <paramref name="result"/> and files the render under the sequence's exports (BRIEF §14.7).
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace Titano.Protocol;
|
||||
[JsonDerivedType(typeof(JobProgressEvent), "jobProgress")]
|
||||
[JsonDerivedType(typeof(JobStateEvent), "jobState")]
|
||||
[JsonDerivedType(typeof(SequenceChangedEvent), "sequenceChanged")]
|
||||
[JsonDerivedType(typeof(CardEvent), "cardEvent")]
|
||||
[JsonDerivedType(typeof(NodeStateEvent), "nodeState")]
|
||||
public abstract record ServerEvent;
|
||||
|
||||
@@ -19,4 +20,24 @@ public sealed record JobStateEvent(Guid JobId, string State, string? Error) : Se
|
||||
|
||||
public sealed record SequenceChangedEvent(Guid SequenceId, string Change, int FramesVersion, int SettingsVersion) : ServerEvent;
|
||||
|
||||
/// <summary>
|
||||
/// A card import that a connected client streams into the server (BRIEF §14.4), as that client reported it
|
||||
/// (<see cref="CardImportReport"/>): <see cref="State"/> is one of <see cref="CardImportStates"/>, <see cref="Done"/>
|
||||
/// counts the photos of its plan handled so far (failures included), <see cref="User"/> and <see cref="ClientName"/>
|
||||
/// say who imports it.
|
||||
/// </summary>
|
||||
public sealed record CardEvent(Guid ImportId, string Card, string State, int Done, int Total, int Failed, string User, string? ClientName) : ServerEvent;
|
||||
|
||||
/// <summary>States of a card import report and of its <see cref="CardEvent"/>.</summary>
|
||||
public static class CardImportStates
|
||||
{
|
||||
public const string Started = "started";
|
||||
public const string Progress = "progress";
|
||||
|
||||
/// <summary>The import ended: every photo handled, or fewer when it stopped early.</summary>
|
||||
public const string Finished = "finished";
|
||||
|
||||
public static bool IsKnown(string? state) => state is Started or Progress or Finished;
|
||||
}
|
||||
|
||||
public sealed record NodeStateEvent(Guid NodeId, string ClientName, string State) : ServerEvent;
|
||||
@@ -35,6 +35,7 @@ namespace Titano.Protocol;
|
||||
[JsonSerializable(typeof(ChunkReceived))]
|
||||
[JsonSerializable(typeof(CompleteUploadResponse))]
|
||||
[JsonSerializable(typeof(UploadState))]
|
||||
[JsonSerializable(typeof(CardImportReport))]
|
||||
[JsonSerializable(typeof(JobDto))]
|
||||
[JsonSerializable(typeof(Page<JobDto>))]
|
||||
[JsonSerializable(typeof(CreateJobRequest))]
|
||||
|
||||
@@ -17,6 +17,13 @@ public sealed record CompleteUploadResponse(Guid FrameId, Guid SequenceId, int I
|
||||
/// <summary><c>GET /api/v1/uploads/{id}</c>: resume state.</summary>
|
||||
public sealed record UploadState(Guid UploadId, string FileName, long Size, string Sha256, int ChunkSize, IReadOnlyList<int> Received, string State);
|
||||
|
||||
/// <summary>
|
||||
/// <c>POST /api/v1/uploads/cards</c>: a client importing a card into the server through these uploads reports its start,
|
||||
/// progress and end (BRIEF §14.4); the server tells every connected client with a <see cref="CardEvent"/> (BRIEF §14.3).
|
||||
/// <see cref="ImportId"/> is the client's import plan, <see cref="Card"/> the card's name as the client shows it.
|
||||
/// </summary>
|
||||
public sealed record CardImportReport(Guid ImportId, string Card, string State, int Done, int Total, int Failed);
|
||||
|
||||
/// <summary>
|
||||
/// <c>POST /api/v1/sequences/{id}/renders</c>: a client offers one of its renders of the sequence (BRIEF §14.5,
|
||||
/// renders are uploaded on request). The render keeps its id on the server, so both sides recognise it; when the
|
||||
|
||||
Reference in new issue
Block a user