Owner review 2, R6: the web panel manages the library without editing it, so the engine and the server must delete single photos safely, keep them out of sync afterwards, and let an administrator restore or finally erase the trash. - Migration 0008: frame_removals (tombstones by sequence and SHA-256, reason, replacement); the sidecar gains "removed" (omitted when empty) and frames a reserved "source"; the indexer writes the tombstones on every sync, so a rebuild keeps them, and drops a hero frame that is gone. - FrameTrash: dry run (busy, frames changed, offline, would empty), delete under the sequence lease with a write-ahead journal that the next writer undoes after a crash, files to trash/photos/<seq>-<time>/originals with a record, sidecar without the frames plus tombstones, index sync clearing analyses, thumbnails and proxies, proxies renamed to follow their frames, follow-up jobs. Restore re-hashes every file, keeps mismatches in the trash, puts the same frame records back and drops their tombstones, or files the photos into a new sequence through the ingest when theirs is gone. - Project positions on vanished photos are translated by photo and wait as pending frames, so they come back with a restore. - Trash entries have a kind (sequence, photos, replaced); emptying is a dry run with a fingerprint and a new EmptyTrash job (18) that erases exactly the planned entries, refuses a stale plan and erases replaced originals only while their replacements still hash right. - Sync honours tombstones: nothing one side deleted is offered back, local files are never deleted, replaced photos count as their replacement; the server answers an upload of a tombstoned SHA-256 as already there. - Server: sequence thumbnail, photo delete, bulk delete/retag/jobs, trash list/restore/empty endpoints with their error messages; a verify of sequences now targets their archive (POST /jobs failed before). - Desktop trash dialog lists photo entries and empties the trash after a typed confirmation through the same job. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 35bb56690a1d69eae57153d036e1409201cd73f7)
178 lines
7.4 KiB
C#
178 lines
7.4 KiB
C#
namespace Chronos.Protocol;
|
|
|
|
/// <summary>Sequence summary for lists (BRIEF §12.2 card data).</summary>
|
|
/// <param name="PreviewOnlyCount">Frames that decode only through their embedded preview (BRIEF §8.2 tier 2).</param>
|
|
public sealed record SequenceDto(
|
|
Guid Id,
|
|
string? Title,
|
|
string DisplayTitle,
|
|
string Folder,
|
|
string? CameraMake,
|
|
string? CameraModel,
|
|
string? Lens,
|
|
DateTime? FirstCapture,
|
|
DateTime? LastCapture,
|
|
int FrameCount,
|
|
double? MedianInterval,
|
|
long TotalBytes,
|
|
long Status,
|
|
int RenderedCount,
|
|
Guid? HeroFrameId,
|
|
IReadOnlyList<string> Tags,
|
|
int Rating,
|
|
string? Notes,
|
|
int SettingsVersion,
|
|
int FramesVersion,
|
|
int WarningCount,
|
|
Guid? OwnerUserId,
|
|
DateTimeOffset UpdatedAt,
|
|
int PreviewOnlyCount = 0);
|
|
|
|
/// <summary>A page of results with an opaque keyset cursor; null cursor = last page.</summary>
|
|
public sealed record Page<T>(IReadOnlyList<T> Items, string? NextCursor, long? Total);
|
|
|
|
/// <summary><c>POST /api/v1/sequences</c>.</summary>
|
|
public sealed record CreateSequenceRequest(string? Title, string? CameraHint);
|
|
|
|
/// <summary>
|
|
/// <c>PATCH /api/v1/sequences/{id}</c>. <see cref="ExpectedSettingsVersion"/> enables conflict detection (409).
|
|
/// <see cref="HeroFrameId"/> names the frame the sequence shows (one of its own; <see cref="Guid.Empty"/> clears it).
|
|
/// <see cref="ExpectedFramesVersion"/> is the frames version the settings' frame positions were written against: the
|
|
/// edit is refused (409 <c>frames_conflict</c>) when frames were added or removed since.
|
|
/// </summary>
|
|
public sealed record UpdateSequenceRequest(
|
|
string? Title,
|
|
IReadOnlyList<string>? Tags,
|
|
int? Rating,
|
|
string? Notes,
|
|
string? SettingsJson,
|
|
int? ExpectedSettingsVersion,
|
|
Guid? HeroFrameId = null,
|
|
int? ExpectedFramesVersion = null);
|
|
|
|
/// <param name="PreviewWidth">Width of the largest embedded preview before orientation, like <paramref name="Width"/>; 0 when unknown.</param>
|
|
/// <param name="PreviewHeight">Height of that preview before orientation; 0 when unknown.</param>
|
|
public sealed record FrameDto(
|
|
Guid Id,
|
|
Guid SequenceId,
|
|
int Index,
|
|
string FileName,
|
|
long Size,
|
|
string? Sha256,
|
|
DateTime? CapturedAt,
|
|
int? UtcOffsetMinutes,
|
|
double? ExposureTime,
|
|
double? FNumber,
|
|
int? Iso,
|
|
double? FocalLength,
|
|
int Orientation,
|
|
int Width,
|
|
int Height,
|
|
string Format,
|
|
long Flags,
|
|
int PreviewWidth = 0,
|
|
int PreviewHeight = 0);
|
|
|
|
/// <summary><c>GET /api/v1/sequences/{id}/manifest</c>: what a client needs to diff a sequence (BRIEF §14.5).</summary>
|
|
/// <param name="Proxies">How to make the proxies the server asks for (<see cref="ManifestFrame.WantsProxy"/>); null when it makes none.</param>
|
|
/// <param name="Removed">
|
|
/// Tombstones of the photos removed from the sequence (owner review 2, R6): a client never offers them back, and counts a
|
|
/// replaced photo and its replacement as one; null from servers before owner review 2 and when there are none.
|
|
/// </param>
|
|
public sealed record SequenceManifest(
|
|
Guid SequenceId,
|
|
int FramesVersion,
|
|
int SettingsVersion,
|
|
string? SettingsJson,
|
|
IReadOnlyList<string> Tags,
|
|
IReadOnlyList<ManifestFrame> Frames,
|
|
IReadOnlyList<RenderDto> Renders,
|
|
ProxySpec? Proxies = null,
|
|
IReadOnlyList<RemovedPhotoDto>? Removed = null);
|
|
|
|
/// <summary>
|
|
/// A photo removed from a sequence (owner review 2, R6): its lower-case hex SHA-256, the replacement's when a conversion
|
|
/// replaced it, why (<c>deleted</c>, <c>replaced</c>) and when.
|
|
/// </summary>
|
|
public sealed record RemovedPhotoDto(string Sha256, string? Replacement, string Reason, DateTimeOffset At);
|
|
|
|
/// <summary>One frame of a manifest: its content, whether the server has a proxy and thumbnail of it, and its flags.</summary>
|
|
/// <param name="Sha256">Lower-case hex SHA-256; empty while the server has not hashed it (a folder adopted and not verified yet).</param>
|
|
/// <param name="Flags">The frame's <c>FrameFlags</c> bits (missing, corrupt, excluded…).</param>
|
|
/// <param name="WantsProxy">
|
|
/// The server cannot decode this original and has no proxy of it (BRIEF §2.3, §8.1: HEIF): a client or render node that
|
|
/// decodes it sends one with <c>PUT /api/v1/frames/{id}/proxy</c>, made as <see cref="SequenceManifest.Proxies"/> says.
|
|
/// </param>
|
|
public sealed record ManifestFrame(Guid Id, int Index, string FileName, long Size, string Sha256, bool HasProxy, bool HasThumb, long Flags = 0,
|
|
bool WantsProxy = false);
|
|
|
|
/// <summary>How the server's proxies are made (BRIEF §8.5): long edge in pixels (0 = full size) and JPEG quality.</summary>
|
|
public sealed record ProxySpec(int LongEdge, int Quality);
|
|
|
|
public sealed record RenderDto(
|
|
Guid Id,
|
|
string PresetName,
|
|
string? Codec,
|
|
int Width,
|
|
int Height,
|
|
double Fps,
|
|
double DurationSeconds,
|
|
long Bytes,
|
|
DateTimeOffset Created,
|
|
string? ProducedBy);
|
|
|
|
/// <summary>Aggregates for the archive dashboard and the admin panel.</summary>
|
|
/// <param name="FreeBytes">Free bytes of the space volume: the server's space path when one is set, else the archive's volume.</param>
|
|
/// <param name="CapacityBytes">Size of the space volume.</param>
|
|
/// <param name="WriteFreeBytes">
|
|
/// Free bytes of the archive's own volume, where uploads are written, when a space path is in use and its figures
|
|
/// differ (an Unraid share's primary storage, often the cache); null otherwise and from servers before owner review 2.
|
|
/// </param>
|
|
/// <param name="WriteCapacityBytes">Size of that write volume, with <paramref name="WriteFreeBytes"/>.</param>
|
|
/// <param name="FileSystem">Filesystem type of the space volume (<c>ext4</c>, <c>NTFS</c>, <c>fuse.shfs</c> for an Unraid share); null when unknown.</param>
|
|
/// <param name="UsesSpacePath">The space volume is the server's space path, not the archive's volume.</param>
|
|
public sealed record ArchiveStatsDto(
|
|
long Sequences,
|
|
long Photos,
|
|
long Bytes,
|
|
long FreeBytes,
|
|
long CapacityBytes,
|
|
int Cameras,
|
|
int? FirstYear,
|
|
int? LastYear,
|
|
IReadOnlyList<KeyValueCount> ByYear,
|
|
IReadOnlyList<KeyValueCount> ByMonth,
|
|
IReadOnlyList<KeyValueCount> ByCamera,
|
|
IReadOnlyList<KeyValueCount> ByFormat,
|
|
int SequencesWithoutProxies,
|
|
int UnverifiedSequences,
|
|
long? WriteFreeBytes = null,
|
|
long? WriteCapacityBytes = null,
|
|
string? FileSystem = null,
|
|
bool UsesSpacePath = false);
|
|
|
|
public sealed record KeyValueCount(string Key, long Count, long Bytes);
|
|
|
|
/// <summary><c>GET /api/v1/sequences/{id}/stats</c>: frame totals by format and flagged frames.</summary>
|
|
public sealed record SequenceStatsDto(
|
|
Guid SequenceId,
|
|
int FrameCount,
|
|
long TotalBytes,
|
|
DateTime? FirstCapture,
|
|
DateTime? LastCapture,
|
|
double? MedianInterval,
|
|
IReadOnlyList<KeyValueCount> ByFormat,
|
|
long MissingFrames,
|
|
long CorruptFrames,
|
|
long DuplicateFrames,
|
|
long ExcludedFrames);
|
|
|
|
/// <summary>
|
|
/// <c>DELETE /api/v1/sequences/{id}</c>: what the delete does (with <c>?dryRun=true</c>) or did. The folder is moved
|
|
/// to <see cref="TrashFolder"/> inside the archive, never erased.
|
|
/// </summary>
|
|
public sealed record SequenceDeletePlan(Guid SequenceId, string? Folder, string? TrashFolder, int FrameCount, long TotalBytes, int RenderCount, bool DryRun);
|
|
|
|
/// <summary><c>GET/PUT /api/v1/archive/settings</c> (admin). The root path comes from the server configuration.</summary>
|
|
public sealed record ArchiveSettingsDto(Guid Id, string Name, string RootPath, string FolderTemplate, string FileTemplate, int ProxyLongEdge);
|