using Titano.Core.Imaging.Decoders; using Titano.Data; using Titano.Data.Archiving; using Titano.Data.Jobs; using Titano.Server.Configuration; namespace Titano.Server.Storage; /// /// The archive engine behind the server (BRIEF §7, §14.4): ingest of verified uploads, lookup of proxies and /// thumbnails, its job handlers (scan, rebuild, verify, import, thumbnails, proxies, maintenance) and the periodic /// incremental scan (); a scan queues thumbnails and proxies of what it indexes, as an upload /// does. Decoding is managed only (BRIEF §4.2). The daily backup of an SQLite index runs with it /// (). /// public static class ArchiveModule { /// Name the server writes into the archive's lease files. public static string Owner { get; } = "server@" + Environment.MachineName; public static void Register(IServiceCollection services) { services.AddSingleton(sp => { var options = sp.GetRequiredService(); // Photos the running job processes at once: the settings' value as it is when each sequence starts (owner review 1). return new ArchiveService(sp.GetRequiredService(), new ArchiveServiceOptions { Decoder = DecoderFactory.CreateServer(), Owner = Owner, ImagesAfterScan = true, Parallelism = () => options.Parallelism }); }); services.AddSingleton(sp => sp.GetRequiredService().Ingest); services.AddSingleton(sp => sp.GetRequiredService()); services.AddSingleton(); services.AddHostedService(); services.AddSingleton(); services.AddHostedService(sp => sp.GetRequiredService()); } }