E2: motore delle copie esterne (porta, destinazioni, piano, copia)
Prima metà della tappa E2 «Copie esterne» (#58), parte Core e Data: - porta del lavoro lungo: importazione, copia e ricostruzione mai insieme; - radice /esporta in Docker con mountinfo, controllo delle cartelle con il file di prova, destinazioni con «Esporta questo account» acceso se Alberto non ha mai scelto (decisione del 27/11/2026); - filtro «Copie», segni delle tessere e conteggi dell'account sui soli file dovuti (D3); - percorsi «Come la libreria», segmento dell'account nella cartella generale, 240 caratteri, storia in evidenza; - piano di «Copia in…», un lavoro per destinazione, copia in .part con SHA-256 riletto dal disco, nome libero, mai sovrascrivere, adozione per percorso, pausa della destinazione su prova, spazio e FAT32, attesa fuori dalle sessioni del motore, ripresa e recupero; - .part rimossi solo nelle cartelle degli elementi di lavori non finiti; - «Tolto» e «Superato» (agganci in importazione, scaricamenti, doppioni e ricostruzione), mai ricopiati da soli; - rapporti e testi in italiano, prove del lavoro di copia. Interfaccia, API e composizione restano alla parte successiva. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
213b89a618
commit
a112c92893
41 files changed
+5370
-27
No files matched your search
@@ -1,4 +1,5 @@
|
||||
using Febe.Core.Domain;
|
||||
using Febe.Core.Export;
|
||||
|
||||
namespace Febe.Core.Storage;
|
||||
|
||||
@@ -169,6 +170,90 @@ public interface IExportStore
|
||||
|
||||
/// <summary>Removes a job with its items. Only records: copies stay.</summary>
|
||||
Task DeleteRunAsync(long runId, CancellationToken ct = default);
|
||||
|
||||
// Tappa E2: the copies to external folders ----------------------------------------------------------------------
|
||||
|
||||
/// <summary>Every recorded «Esporta questo account», in one read: only accounts with a row (absent = the default).</summary>
|
||||
Task<IReadOnlyDictionary<long, bool>> ListAccountExportSwitchesAsync(CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// The newest Superseded or Removed row of (destination, account) whose <see cref="ExportCopy.SupersededBySha256"/> is
|
||||
/// this SHA-256: the library file that took the place of a copied one, never copied again by itself.
|
||||
/// </summary>
|
||||
Task<ExportCopy?> FindReplacedCopyAsync(long destinationId, long accountId, string sha256, CancellationToken ct = default);
|
||||
|
||||
/// <summary>«Una copia sola»: the newest Copied row of this original, variant and format in a destination in use, any account.</summary>
|
||||
Task<ExportCopy?> FindCopiedElsewhereAsync(string sha256, ExportVariant variant, ExportFormat format, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// The state of whole copies (<see cref="ExportVariant.Whole"/>, <see cref="ExportFormat.Original"/>) of (account,
|
||||
/// SHA-256) pairs in one destination, for the plan: the current row (Copied or Failed) first, else the newest row
|
||||
/// when Removed or Superseded, else Removed or Superseded when a row was replaced by this SHA-256
|
||||
/// (<see cref="FindReplacedCopyAsync"/>). Pairs without any are absent.
|
||||
/// </summary>
|
||||
Task<IReadOnlyDictionary<(long AccountId, string Sha256), ExportCopyState>> GetCopyStatesAsync(
|
||||
long destinationId,
|
||||
IReadOnlyCollection<(long AccountId, string Sha256)> keys,
|
||||
CancellationToken ct = default);
|
||||
|
||||
/// <summary>«Controlla le copie»: Copied or Superseded rows become Removed («Tolto», state time <paramref name="at"/>) in one transaction. Returns the rows changed.</summary>
|
||||
Task<int> MarkCopiesRemovedAsync(IReadOnlyList<long> copyIds, DateTimeOffset at, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// The library files of a «Copia in…», by media id, a page at a time (after <paramref name="afterMediaId"/>), present
|
||||
/// or not: the plan decides. An account gives the files of its entries in the library (visible states); a filter
|
||||
/// the files of its entries (with «Tutte le foto», only the files it shows).
|
||||
/// </summary>
|
||||
Task<IReadOnlyList<ExportCandidate>> ListCandidatesAsync(ExportSelection selection, long afterMediaId, int limit, CancellationToken ct = default);
|
||||
|
||||
/// <summary>Jobs for the Dashboard: newest first, at most <paramref name="limit"/>.</summary>
|
||||
Task<IReadOnlyList<ExportRun>> ListRecentRunsAsync(int limit, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// The mark of each tile of a page (decision D3 of tappa E2): of the files of the entry that are due (present, of an
|
||||
/// account with «Esporta questo account» on, a destination and a content type it takes), how many are copied in
|
||||
/// the account's effective destination. Entries without due files are absent.
|
||||
/// </summary>
|
||||
Task<IReadOnlyDictionary<long, ExportMark>> GetEntryMarksAsync(IReadOnlyList<long> entryIds, CancellationToken ct = default);
|
||||
|
||||
/// <summary>The mark of single files («Tutte le foto»): Copied or None; files that are not due are absent.</summary>
|
||||
Task<IReadOnlyDictionary<long, ExportMark>> GetFileMarksAsync(IReadOnlyList<long> mediaIds, CancellationToken ct = default);
|
||||
|
||||
/// <summary>The counts of the account card: «312 su 1.204 non ancora copiati» (decision D3 of tappa E2).</summary>
|
||||
Task<ExportAccountCounts> CountAccountFilesAsync(long accountId, CancellationToken ct = default);
|
||||
}
|
||||
|
||||
/// <summary>A library file a «Copia in…» may copy (one row per media, with what the plan needs of its entry).</summary>
|
||||
public sealed record ExportCandidate(
|
||||
long MediaId,
|
||||
long EntryId,
|
||||
long AccountId,
|
||||
EntryKind EntryKind,
|
||||
MediaKind MediaKind,
|
||||
MediaState State,
|
||||
string? Sha256,
|
||||
long? Bytes,
|
||||
string? RelativePath,
|
||||
int Position,
|
||||
bool InHighlight);
|
||||
|
||||
/// <summary>The copy mark of a tile (spec §4.10): «Non ancora copiato», «Copiato in parte», «Copiato».</summary>
|
||||
public enum ExportMark
|
||||
{
|
||||
None,
|
||||
Partly,
|
||||
Copied,
|
||||
}
|
||||
|
||||
/// <summary>Counts of the due files of an account (decision D3 of tappa E2).</summary>
|
||||
/// <param name="Due">Files that go to the account's effective destination.</param>
|
||||
/// <param name="NotCopied">Due files «Copia in…» would copy: neither copied nor «Tolti o superati» (failed ones included).</param>
|
||||
/// <param name="RemovedOrSuperseded">Due files whose copy was removed from the destination or superseded: never copied again by themselves.</param>
|
||||
/// <param name="Failed">Due files whose last copy failed (also counted in <paramref name="NotCopied"/>).</param>
|
||||
public sealed record ExportAccountCounts(int Due, int NotCopied, int RemovedOrSuperseded, int Failed)
|
||||
{
|
||||
/// <summary>Due files copied.</summary>
|
||||
public int Copied => Due - NotCopied - RemovedOrSuperseded;
|
||||
}
|
||||
|
||||
/// <summary>A page of the items of an export job.</summary>
|
||||
|
||||
@@ -30,6 +30,22 @@ public enum LibraryKindFilter
|
||||
Posts,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The «Copie» filter (spec §4.6, §4.10), over the files that are due (decision D3 of tappa E2): «Non ancora copiati»,
|
||||
/// «Copiati», «Tolti o superati». Null: «Tutti».
|
||||
/// </summary>
|
||||
public enum LibraryCopiesFilter
|
||||
{
|
||||
/// <summary>«Non ancora copiati»: an entry with a due file that «Copia in…» would copy (a failed copy included).</summary>
|
||||
NotCopied,
|
||||
|
||||
/// <summary>«Copiati»: an entry whose due files are all copied in their effective destination.</summary>
|
||||
Copied,
|
||||
|
||||
/// <summary>«Tolti o superati»: an entry with a due file whose copy was removed or superseded (never copied again by itself).</summary>
|
||||
RemovedOrSuperseded,
|
||||
}
|
||||
|
||||
/// <summary>Filters of the library mosaic and of the account tabs (spec §4.6).</summary>
|
||||
public sealed record LibraryFilter
|
||||
{
|
||||
@@ -54,6 +70,9 @@ public sealed record LibraryFilter
|
||||
|
||||
/// <summary>Entry states shown. Null means <see cref="EntryStateRules.Visible"/> (entries with files).</summary>
|
||||
public IReadOnlyList<EntryState>? States { get; init; }
|
||||
|
||||
/// <summary>«Copie» (null: «Tutti»). With «Tutte le foto» it applies to each file.</summary>
|
||||
public LibraryCopiesFilter? Copies { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in new issue
Block a user