feat(data): archive ingest contract shared by server uploads and card import
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
1 file changed
+30
@@ -0,0 +1,30 @@
|
|||||||
|
namespace Titano.Data.Archive;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A verified file waiting in a staging folder on the archive volume, ready to become a frame (BRIEF §4.3, §14.4).
|
||||||
|
/// Exactly one of <see cref="SequenceId"/>, <see cref="NewSequenceTitle"/> or <see cref="SessionKey"/> selects the target:
|
||||||
|
/// an existing sequence, a new one with that title, or the sequence grouped automatically by session.
|
||||||
|
/// </summary>
|
||||||
|
public sealed record IngestRequest(
|
||||||
|
Guid ArchiveId,
|
||||||
|
Guid? SequenceId,
|
||||||
|
string? NewSequenceTitle,
|
||||||
|
string? SessionKey,
|
||||||
|
string StagedPath,
|
||||||
|
string OriginalFileName,
|
||||||
|
long Size,
|
||||||
|
string Sha256,
|
||||||
|
DateTime? ClientCapturedAt,
|
||||||
|
Guid? UserId);
|
||||||
|
|
||||||
|
/// <summary>The committed frame; <see cref="Duplicate"/> when the sequence already held a frame with that SHA-256.</summary>
|
||||||
|
public sealed record IngestResult(Guid SequenceId, Guid FrameId, int Index, string RelativePath, bool Duplicate);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Commits staged files into the archive layout (originals folder, naming templates, <c>sequence.json</c> written
|
||||||
|
/// atomically) and the index. Used by the server's upload completion and by the client's card import.
|
||||||
|
/// </summary>
|
||||||
|
public interface IArchiveIngest
|
||||||
|
{
|
||||||
|
Task<IngestResult> CommitAsync(IngestRequest request, CancellationToken cancellationToken = default);
|
||||||
|
}
|
||||||
Reference in new issue
Block a user