E3: conversione della libreria in sottofondo con righe sempre vere
La libreria può ora tenere accanto a ogni originale una copia nel formato scelto, preparata in sottofondo senza mai sostituire o cancellare l'originale. - LongWorkGate ha un permesso di sottofondo che il lavoro in primo piano (importazione, copie, ricostruzione) interrompe; il salvataggio in corso si aspetta al più CommitWait. - La coda e il lavoratore: nuovi file accodati all'arrivo, quelli già in libreria solo su richiesta, pausa, nuovo tentativo, attesa durante una sessione del motore o con poco spazio, nomi liberi e adozione di un file identico già presente. - Le righe di media_conversion restano vere in ogni via: eliminazione (Ricorda e Consenti il ritorno, con RemoveWithConversionsAsync per il vincolo RESTRICT), perdente del ripasso dei doppioni, file cambiato (superate e riaccodate), ricostruzione (conta e riconosce i convertiti, accoda solo Pending), importazione (una copia convertita o un fotogramma non rientra come file nuovo). - FebeApp avvia il lavoratore con InBackground; la demo mai. _febe.jsonl non cambia. La prova RecordsCannotBeDeletedFromUnderTheirCopies usa ora una riga Converted: RemoveAsync toglie da sé le righe senza file, e il vincolo si verifica sia in SQL sia attraverso il magazzino. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b746aff45d
commit
724c5bda6f
25 files changed
+2621
-38
No files matched your search
@@ -1,4 +1,5 @@
|
||||
using Febe.Core.Domain;
|
||||
using Febe.Core.Library.Conversion;
|
||||
using Febe.Core.Storage;
|
||||
|
||||
namespace Febe.Core.Export;
|
||||
@@ -25,6 +26,7 @@ public static class ExportSupersession
|
||||
}
|
||||
|
||||
var old = oldSha256.ToLowerInvariant();
|
||||
await LibraryConversionsChangedAsync(storage, accountId, old, newSha256.ToLowerInvariant(), at).ConfigureAwait(false);
|
||||
var users = await storage.Media.FindBySha256Async(old, ct).ConfigureAwait(false);
|
||||
if (users.Any(u => u.Entry.AccountId == accountId && EntryStateRules.IsPresent(u.Media.State)))
|
||||
{
|
||||
@@ -33,4 +35,31 @@ public static class ExportSupersession
|
||||
|
||||
return await storage.Exports.SupersedeCopiesAsync(accountId, old, newSha256.ToLowerInvariant(), at, CancellationToken.None).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The conversions for the library of the account's file that now has <paramref name="newSha256"/> (tappa E3,
|
||||
/// WP2.4): a converted file of the old bytes is «Superato» (it stays), the queue and the failures take the new bytes,
|
||||
/// and the file is queued again in the library formats set now.
|
||||
/// </summary>
|
||||
private static async Task LibraryConversionsChangedAsync(IFebeStorage storage, long accountId, string oldSha256, string newSha256, DateTimeOffset at)
|
||||
{
|
||||
var none = CancellationToken.None;
|
||||
var changed = await storage.Conversions.SupersedeAsync(accountId, oldSha256, newSha256, at, none).ConfigureAwait(false);
|
||||
if (changed.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var media = new List<Media>();
|
||||
foreach (var id in changed)
|
||||
{
|
||||
if (await storage.Media.GetAsync(id, none).ConfigureAwait(false) is { } m)
|
||||
{
|
||||
media.Add(m);
|
||||
}
|
||||
}
|
||||
|
||||
await LibraryConversionQueue.EnqueueEntryAsync(storage, media, at, none).ConfigureAwait(false);
|
||||
LibraryConversionQueue.Signal();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user