Files
Chronos/src/Chronos.Data/Archiving/IArchiveIngest.cs
T
Alby96andClaude Opus 5.5 9aa818ed47
CI / Build and test (push) Successful in 7m25s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 10s
CI / PostgreSQL 16 integration (push) Successful in 5m20s
CI / PostgreSQL 17 integration (push) Successful in 5m22s
CI / Docker image (push) Successful in 50s
Release / Build, test and publish (push) Successful in 12m1s
Release / Server image (push) Successful in 1m26s
feat: owner review 2 phase 3: Library on the web panel, photo trash and web upload (#11)
- Web panel Library: browse, view, delete sequences and photos, mass operations (analyse, proxies, thumbnails, verify, retag, delete, CSV). It never edits the video.
- Photo trash with tombstones (migration 0008): crash-safe delete and restore, hash-checked restore with reasons, and emptying only by an explicit fingerprinted job. Sync and uploads keep deleted photos deleted; an explicit "Upload again" brings one back.
- Upload from the web panel: in-house SHA-256 in a worker with a fail-closed self-test, capture time from EXIF, chunked, resumable; no folders.
- Desktop trash dialog with photo entries and Empty.
- Admin files are revalidated (no-cache + ETag).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
2026-10-27 15:08:39 +01:00

50 lines
2.5 KiB
C#

namespace Chronos.Data.Archiving;
/// <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>
/// <param name="RefuseRemoved">Content the target sequence tombstoned (a photo deleted from it, none of its frames holding
/// that content) is refused with <see cref="PhotoRemovedException"/>, checked under the sequence's lease with the commit, so
/// no deletion lands in between: an upload that does not ask to bring the photo back. Otherwise filing it drops the
/// tombstone (a card imported again, a sync download, an explicit upload again).</param>
public sealed record IngestRequest(
Guid ArchiveId,
Guid? SequenceId,
string? NewSequenceTitle,
string? SessionKey,
string StagedPath,
string OriginalFileName,
long Size,
string Sha256,
DateTime? ClientCapturedAt,
Guid? UserId,
bool RefuseRemoved = false);
/// <summary>
/// The target sequence tombstoned the content of an <see cref="IngestRequest"/> that refuses it
/// (<see cref="IngestRequest.RefuseRemoved"/>): the photo was deleted from it. Nothing was filed; the staged file stays.
/// </summary>
public sealed class PhotoRemovedException(Guid sequenceId, string sha256)
: InvalidOperationException($"Sequence {sequenceId} tombstoned {sha256}: the photo was deleted from it and is not filed again.")
{
public Guid SequenceId { get; } = sequenceId;
}
/// <summary>
/// The committed frame; <see cref="Duplicate"/> when an intact frame of the sequence already held that SHA-256 (the file
/// stays in staging). A frame with that SHA-256 that was missing or damaged is repaired with the file instead:
/// <see cref="Repaired"/>, not a duplicate, and the archive holds no more bytes than before.
/// </summary>
public sealed record IngestResult(Guid SequenceId, Guid FrameId, int Index, string RelativePath, bool Duplicate, bool Repaired = false);
/// <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);
}