M1 Dati e libreria: modello, archivi SQLite con scrittore unico, nomi dei file, scrittura sicura, miniature, impronte, _febe.jsonl, copie, eliminazione e ricostruzione

Modello del dominio e interfacce degli archivi in Febe.Core; implementazione SQLite in Febe.Data (WAL, chiavi esterne, migrazioni numerate in transazione, coda di scrittura su un solo thread); logica della libreria in Febe.Core/Library; 164 prove MSTest, compresa la ricostruzione del database da una libreria di prova e la scala a 200.000 elementi.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01Mzbb6zeFTjT6Rp8b92AVkA
This commit is contained in:
Claude committed 2026-10-13 16:06:15 +00:00
1 parent c803bd98b5
commit 3aeaa17da7
69 files changed
+12472

No files matched your search

+58
View File
@@ -0,0 +1,58 @@
namespace Febe.Core.Storage;
/// <summary>
/// Everything Febe keeps in its database, as one object (implemented by <c>Febe.Data.FebeDatabase</c>).
/// Writes are serialized by a single writer; reads run concurrently.
/// </summary>
public interface IFebeStorage : IAsyncDisposable
{
IAccountStore Accounts { get; }
IEntryStore Entries { get; }
IMediaStore Media { get; }
IHighlightStore Highlights { get; }
IDuplicateStore Duplicates { get; }
ITaskStore Tasks { get; }
IActionLogStore ActionLog { get; }
ISessionStore Sessions { get; }
IIncidentStore Incidents { get; }
IEventStore Events { get; }
IFollowingStore Following { get; }
IImportStore Imports { get; }
ISettingsStore Settings { get; }
IDatabaseMaintenance Maintenance { get; }
}
/// <summary>Maintenance of the database file.</summary>
public interface IDatabaseMaintenance
{
/// <summary>Full path of the database file.</summary>
string DatabasePath { get; }
/// <summary>Schema version (PRAGMA user_version).</summary>
int SchemaVersion { get; }
/// <summary>
/// Writes a consistent copy of the database to a new file with <c>VACUUM INTO</c> (spec §8.5).
/// The destination must not exist.
/// </summary>
Task BackupToAsync(string destinationFile, CancellationToken ct = default);
/// <summary>Runs <c>PRAGMA quick_check</c>; true when the database is sound.</summary>
Task<bool> CheckIntegrityAsync(CancellationToken ct = default);
/// <summary>Lets SQLite refresh its statistics (<c>PRAGMA optimize</c>).</summary>
Task OptimizeAsync(CancellationToken ct = default);
}