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>
This commit is contained in:
1 parent
43719bb5c5
commit
283d04d9cd
57 files changed
+3302
-26
No files matched your search
@@ -0,0 +1,42 @@
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Data.Sync;
|
||||
|
||||
namespace Chronos.Data.Copies;
|
||||
|
||||
/// <summary>One difference of title, tags, rating, notes or settings between two copies (a JSON path, both values as shown).</summary>
|
||||
public sealed record DetailLine(string Path, string? Here, string? There);
|
||||
|
||||
/// <summary>A project of one home, as the Projects part lists it.</summary>
|
||||
public sealed record ProjectLine(Guid Id, string Name, bool IsMain, int Versions, Guid HeadId, string HeadHash, DateTimeOffset UpdatedAt);
|
||||
|
||||
/// <summary>
|
||||
/// Both homes' projects. MainSame: the two Main heads make the same choices; ThereKeepsProjects: the other home keeps
|
||||
/// projects (a server without the <c>projects</c> capability keeps none).
|
||||
/// </summary>
|
||||
public sealed record CopyProjectsView(IReadOnlyList<ProjectLine> Here, IReadOnlyList<ProjectLine> There, bool MainSame, bool ThereKeepsProjects);
|
||||
|
||||
/// <summary>Renders of each side, and those both hold (by render id, or by SHA-256 where both record one).</summary>
|
||||
public sealed record CopyRendersView(int Here, int There, int Shared, long HereBytes, long ThereBytes);
|
||||
|
||||
/// <summary>
|
||||
/// The facts of one side: title, where it lies (archive or server name), photos, bytes, capture range, camera, hashed count,
|
||||
/// origin, the servers the local copy is linked to, and whether it lies in a server's originals archive.
|
||||
/// </summary>
|
||||
public sealed record CopyFacts(string Title, string Where, Guid? ArchiveId, int Photos, long Bytes, DateTime? First, DateTime? Last,
|
||||
string? Camera, int Hashed, SequenceOrigin? Origin, IReadOnlyList<string> Servers, bool InOriginalsArchive);
|
||||
|
||||
/// <summary>What the Compare dialog shows of a pair: both sides, the photos, the details line by line, projects, renders, and what can be done.</summary>
|
||||
public sealed record CopyReview(FoundCopy Copy, CopyFacts Here, CopyFacts There, CopyComparisonResult Photos,
|
||||
IReadOnlyList<DetailLine> Details, CopyProjectsView Projects, CopyRendersView Renders, CopyCapabilities Can);
|
||||
|
||||
/// <summary>Whether Integrate (or Merge), Link only and Delete on server are possible, and why not (<see cref="CopyBlock"/>s).</summary>
|
||||
public sealed record CopyCapabilities(bool Integrate, bool LinkOnly, bool DeleteThere, IReadOnlyList<CopyBlock> Blocks);
|
||||
|
||||
/// <summary>A row of Server › Matches: the pair with the facts of both sides (the other side's from the server listing or the other archive).</summary>
|
||||
public sealed record FoundCopyView(FoundCopy Copy, CopyFacts Here, CopyFacts There);
|
||||
|
||||
/// <summary>
|
||||
/// The same time-lapse with workspace projects at two homes (a linked or integrated pair): the Edit picker marks each as the
|
||||
/// other's twin. LocalHome names the local copy's archive; a project name is null when that home has no workspace project.
|
||||
/// </summary>
|
||||
public sealed record CopyTwin(Guid CopyId, Guid LocalId, string LocalHome, string? LocalProject, string Server, Guid RemoteId, string? ServerProject);
|
||||
Reference in new issue
Block a user