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
+22
-1
@@ -14,6 +14,7 @@ using Febe.Core.Engine;
|
||||
using Febe.Core.Export;
|
||||
using Febe.Core.Import;
|
||||
using Febe.Core.Library;
|
||||
using Febe.Core.Library.Conversion;
|
||||
using Febe.Core.Security;
|
||||
using Febe.Core.Storage;
|
||||
using Febe.Data;
|
||||
@@ -194,9 +195,12 @@ public sealed class FebeApp : IAsyncDisposable
|
||||
DataFolder = data.Root,
|
||||
Gate = longWork,
|
||||
});
|
||||
var idleConversion = new LibraryConversionWorker(new LibraryConversionEnvironment { Storage = Database, Layout = () => library.Layout, Clock = Clock, Gate = longWork });
|
||||
await StartWebAsync(hooks, services =>
|
||||
{
|
||||
services.AddSingleton(longWork);
|
||||
services.AddSingleton(idleConversion);
|
||||
services.AddSingleton(new LibraryConversionQueue(Database, Clock));
|
||||
services.AddSingleton(ExportRootOptions.Docker(Path.Combine(_temporaryFolder, "esporta"), declared: false));
|
||||
services.AddSingleton<IFebeStorage>(Database);
|
||||
services.AddSingleton(library);
|
||||
@@ -336,12 +340,28 @@ public sealed class FebeApp : IAsyncDisposable
|
||||
_telegram = new TelegramClient(hooks.TelegramHandler);
|
||||
var telegramChannel = new TelegramAlertChannel(_telegram);
|
||||
|
||||
// The conversion for the library (tappa E3, spec §4.10): one worker, started below in the background; it yields
|
||||
// to import, copies and rebuild through the gate and never runs during an engine session. Never in the demo.
|
||||
var sessionState = new RuntimeSessionState(services.Runtime);
|
||||
var conversion = new LibraryConversionWorker(new LibraryConversionEnvironment
|
||||
{
|
||||
Storage = Database,
|
||||
Layout = () => library.Layout,
|
||||
Clock = Clock,
|
||||
Gate = longWork,
|
||||
Session = sessionState,
|
||||
FreeSpace = hooks.FreeSpace ?? new DriveFreeSpaceProbe(),
|
||||
Log = message => Log.Write(LogLevel.Warning, "conversione", message),
|
||||
});
|
||||
|
||||
await StartWebAsync(hooks, s =>
|
||||
{
|
||||
s.AddSingleton(longWork);
|
||||
s.AddSingleton(conversion);
|
||||
s.AddSingleton(new LibraryConversionQueue(Database, Clock));
|
||||
s.AddSingleton(exportRoot);
|
||||
s.AddSingleton<IExportDisk>(hooks.ExportDisk ?? new SystemExportDisk(exportRoot.Mounts));
|
||||
s.AddSingleton<IEngineSessionState>(new RuntimeSessionState(services.Runtime));
|
||||
s.AddSingleton<IEngineSessionState>(sessionState);
|
||||
s.AddSingleton<IFebeStorage>(Database);
|
||||
s.AddSingleton(library);
|
||||
s.AddSingleton<IClock>(Clock);
|
||||
@@ -398,6 +418,7 @@ public sealed class FebeApp : IAsyncDisposable
|
||||
InBackground(() => BackupLoopAsync(new DailyBackup(Database, Clock, data.Backups), lifetime));
|
||||
InBackground(() => BringUpBrowserAsync(ingest, staging, services, engine, runner, search, lifetime));
|
||||
InBackground(() => Alerts.WatchDiskSpaceAsync(lifetime));
|
||||
InBackground(() => conversion.RunAsync(lifetime));
|
||||
}
|
||||
|
||||
/// <summary>Runs <paramref name="work"/> in the background; the stop waits for it.</summary>
|
||||
|
||||
Reference in new issue
Block a user