From ece7f1add0f8531ef66fee27d7e4651628d9704c Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 2 Oct 2026 10:44:34 +0000 Subject: [PATCH] feat(data): archive ingest contract shared by server uploads and card import Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC --- src/Titano.Data/Archive/IArchiveIngest.cs | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/Titano.Data/Archive/IArchiveIngest.cs diff --git a/src/Titano.Data/Archive/IArchiveIngest.cs b/src/Titano.Data/Archive/IArchiveIngest.cs new file mode 100644 index 00000000..63c53889 --- /dev/null +++ b/src/Titano.Data/Archive/IArchiveIngest.cs @@ -0,0 +1,30 @@ +namespace Titano.Data.Archive; + +/// +/// 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 , or selects the target: +/// an existing sequence, a new one with that title, or the sequence grouped automatically by session. +/// +public sealed record IngestRequest( + Guid ArchiveId, + Guid? SequenceId, + string? NewSequenceTitle, + string? SessionKey, + string StagedPath, + string OriginalFileName, + long Size, + string Sha256, + DateTime? ClientCapturedAt, + Guid? UserId); + +/// The committed frame; when the sequence already held a frame with that SHA-256. +public sealed record IngestResult(Guid SequenceId, Guid FrameId, int Index, string RelativePath, bool Duplicate); + +/// +/// Commits staged files into the archive layout (originals folder, naming templates, sequence.json written +/// atomically) and the index. Used by the server's upload completion and by the client's card import. +/// +public interface IArchiveIngest +{ + Task CommitAsync(IngestRequest request, CancellationToken cancellationToken = default); +}