On Unraid the archive is a user share (FUSE shfs), which reports the share's primary storage, often the cache, while the mover sends the photos to the array: the admin panel showed the cache's free space (owner review 2, R2). - New option SpacePath (server.json) / CHRONOS_SPACE_PATH: the admin panel shows that folder's volume; empty, or a folder that cannot be measured, falls back to the archive's volume (one warning, at start, not per request). - VolumeSpace measures folders (DriveInfo; the path root on Windows) and reads the filesystem type and mount from /proc/self/mountinfo on Linux (longest mount point on segment boundaries, octal escapes, optional fields, the top of stacked mounts), since DriveFormat calls an shfs share only "fuse". It is an injectable service, so tests simulate a full volume; the /data checks use it. - ArchiveStatsDto keeps FreeBytes/CapacityBytes for the shown volume and gains optional trailing members: the write volume's figures (when a space path is in use and they differ), the filesystem type and UsesSpacePath. - Admin panel (dashboard and archive): a tooltip on the storage figures names the volume and its filesystem and, on an shfs share without a space path, says they are the primary storage and to map the array view to /space; a "Write volume" line shows the archive's own volume when it differs. - Completing an upload, a render upload or a render node's result checks the archive volume for its size plus the 64 MiB reserve before the staging copy and answers 507 insufficient_storage, the upload still receiving. - Diagnostics list the archive and space volumes with filesystem and mount. - Unraid template: optional read-only "Array view" /space (default /mnt/user0/Timelapse) and "Space path" CHRONOS_SPACE_PATH=/space; compose and the releases README describe the same as an option. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
167 lines
6.8 KiB
C#
167 lines
6.8 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>
|
|
public sealed record SequenceManifest(
|
|
Guid SequenceId,
|
|
int FramesVersion,
|
|
int SettingsVersion,
|
|
string? SettingsJson,
|
|
IReadOnlyList<string> Tags,
|
|
IReadOnlyList<ManifestFrame> Frames,
|
|
IReadOnlyList<RenderDto> Renders,
|
|
ProxySpec? Proxies = null);
|
|
|
|
/// <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);
|