Files
Chronos/src/Chronos.Core/Model/Enums.cs
T
Alby96andClaude Opus 5.5 283d04d9cd feat: found copies foundation (contracts, migration 0012, store, wire, trash and job hooks, keys)
Owner review 6 asks Chronos to recognise the same time-lapse held under different ids on the
server and on this PC, compare the copies, and keep them apart or integrate and sync them. This
lays the shared foundation the later parcels build on, without any UI or detection yet.

- Migration 0012 adds found_copies (local-server and local-local pairs with evidence, scores,
  answer, policy and the 404 record) and copy_probes; every existing link with a local sequence
  becomes a Linked pair, so a server deletion and the per-link policy have a place.
- FoundCopyStore keeps the pairs: upserts that never touch the answer, a compare-and-set of the
  state with an Integrating backstop (a failed or cancelled job reads as the previous state),
  link promotion and demotion, the once-per-refresh 404 count, the merge's links stage
  (session keys, links reset, pairs moved, refused when both are linked on one server), the
  local overlap queries and the probes. SyncLinkStore.RekeyAsync moves pairs and probes with
  the links in the same transaction.
- Contracts for detection, review, plans, the Integrate and MergeSequences jobs (kinds 25/26,
  High level, new detail steps) and the Upload all rule that keeps suspected, kept-apart,
  deleted, busy and server-born sequences here.
- Wire: POST photos/lookup, uploads into a target (IntoTarget/Copied, trailing and optional),
  frames/delete on the client, capabilities photo-lookup and upload-into, cached per remote.
- The trash plans and deletes accept the job that holds the sequence (its own hold is not
  Busy) and a frames version checked under the lease; a Background job never interrupts a
  running one.
- Settings for linking, the photo policy and projects; the en and it keys of design section 9.

Refs #73

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 19:39:04 +01:00

208 lines
5.5 KiB
C#

namespace Chronos.Core.Model;
/// <summary>Where a capture timestamp came from.</summary>
public enum TimestampSource
{
Unknown = 0,
ExifOriginal,
ExifCreate,
Xmp,
QuickTime,
Gps,
FileSystem,
}
[Flags]
public enum FrameFlags
{
None = 0,
Missing = 1,
Corrupt = 2,
Duplicate = 4,
Excluded = 8,
PreviewOnly = 16,
Undecodable = 32,
Black = 64,
White = 128,
/// <summary>
/// The camera's own interval-shooting or time-lapse mode took the frame (MakerNote hint, BRIEF §9): a capture fact,
/// not a problem; its pauses were deliberate (§10.3 adaptive timing).
/// </summary>
Intervalometer = 256,
}
[Flags]
public enum SequenceStatus
{
None = 0,
AnalyzedLight = 1,
AnalyzedDeep = 2,
ProxiesBuilt = 4,
ThumbsBuilt = 8,
Verified = 16,
HasWarnings = 32,
HasErrors = 64,
}
public enum SequenceOrigin
{
Local,
Server,
}
public enum SyncState
{
LocalOnly,
InSync,
LocalAhead,
ServerAhead,
Conflict,
RemoteOnly,
}
public enum JobKind
{
Scan,
Rebuild,
Verify,
LightAnalyse,
DeepAnalyse,
Proxies,
Thumbs,
Render,
Import,
UploadCommit,
Maintenance,
Duplicates,
Orphans,
Adopt,
Move,
/// <summary>Client: originals or proxies of a server sequence fetched into this PC (BRIEF §14.5).</summary>
Download,
/// <summary>A <c>VACUUM INTO</c> copy of an SQLite index into the backups folder (owner review 2, R10); stored as 16.</summary>
Backup = 16,
/// <summary>Housekeeping steps: job history, audit log, trash report and the host's own (owner review 2, R10); stored as 17.</summary>
Cleanup = 17,
/// <summary>
/// Erases exactly the trash entries of a confirmed plan, refused when the trash changed since (owner review 2, R6); stored
/// as 18.
/// </summary>
EmptyTrash = 18,
/// <summary>
/// A mass conversion of sequences to JPEG, TIFF-16 or linear DNG, replacing their frames or into new sequences, as
/// confirmed (owner review 2, R7); stored as 19.
/// </summary>
Convert = 19,
/// <summary>
/// Copies a sequence's proxies (and its deep report) from its home into a workspace project's media folder, hash-verified
/// and resumable (owner review 2, R8); stored as 20.
/// </summary>
WorkspaceCopy = 20,
/// <summary>
/// Renders a workspace project from the originals the workspace holds, on this PC, into the project's <c>exports/</c>
/// with a ledger entry per output (owner review 2, R8, phase 5c); stored as 21.
/// </summary>
WorkspaceRender = 21,
/// <summary>
/// Sends a workspace project's local renders home (this PC's archive or its server) with their project and version,
/// each hash-checked and idempotent by render id (owner review 2, R8, phase 5c); stored as 22.
/// </summary>
WorkspaceSend = 22,
/// <summary>
/// Moves the workspace folder with its projects to another folder, journaled and hash-verified across volumes, the
/// source kept until every file is verified (owner review 2, R8, phase 5c); stored as 23.
/// </summary>
WorkspaceMove = 23,
/// <summary>
/// Copies renders into the videos folder (owner review 1, R9), each copy hash-verified against its render before it takes
/// its name, the render itself never touched; on the desktop a server-only render is downloaded into it; stored as 24.
/// </summary>
VideoCopy = 24,
/// <summary>
/// Integrates a local sequence with its match on a server (owner review 6, #73): each side receives the photos it lacks,
/// the details are settled once as chosen, other projects are copied across, then the two stay linked; journaled,
/// resumable and hash-verified; stored as 25.
/// </summary>
Integrate = 25,
/// <summary>
/// Merges two local copies of one time-lapse into the kept sequence (owner review 6, #73): every photo verified in it,
/// then the other sequence goes to the archive trash; journaled and resumable; stored as 26.
/// </summary>
MergeSequences = 26,
}
/// <summary>Why a photo left a sequence (its tombstone, owner review 2, R6); stored as a number.</summary>
public enum RemovalReason
{
/// <summary>Deleted by a user into the archive's trash.</summary>
Deleted = 0,
/// <summary>Replaced by a converted file (owner review 2, R7): the tombstone names the replacement's SHA-256.</summary>
Replaced = 1,
}
public enum JobState
{
Queued,
Running,
Paused,
Done,
Failed,
Cancelled,
}
public enum JobPriority
{
Background = 0,
Normal = 1,
User = 2,
}
public enum UserRole
{
Viewer,
Uploader,
Editor,
Admin,
}
[Flags]
public enum Permissions : long
{
None = 0,
Read = 1,
Upload = 2,
Edit = 4,
Delete = 8,
Render = 16,
RenderNode = 32,
ManageArchive = 64,
ManageUsers = 128,
All = Read | Upload | Edit | Delete | Render | RenderNode | ManageArchive | ManageUsers,
}
public static class RolePermissions
{
public static Permissions Default(UserRole role) => role switch
{
UserRole.Admin => Permissions.All,
UserRole.Editor => Permissions.Read | Permissions.Upload | Permissions.Edit | Permissions.Delete | Permissions.Render | Permissions.RenderNode,
// Upload only: an uploader lists sequences to pick a target but cannot open them (AdminUsers mockup).
UserRole.Uploader => Permissions.Upload,
_ => Permissions.Read,
};
}