E2: API delle copie esterne, composizione e dimostrazione
Le copie esterne diventano usabili dall'interfaccia: ExportHub costruisce l'unico ExportService del web (segna «interrotto» ciò che l'arresto ha fermato e avvisa le pagine a lavoro finito), ExportApi espone cartelle, scelta e controllo della cartella, «Copia in…» (piano e avvio), «Copia di nuovo», avanzamento, lavori, ripresa, annullamento e resoconto. Gli endpoint esistenti portano le copie: filtro copies= della Libreria, segno «Copiato» / «Copiato in parte 1/3» sulle tessere, copie di ogni file nel visualizzatore, riquadro «Copie esterne» e interruttore «Esporta questo account» nella scheda. Una cartella di account o della libreria che finirebbe dentro (o attorno a) una cartella delle copie è rifiutata; dopo una ricostruzione le cartelle in conflitto vanno in pausa. Composizione: in Docker le copie si scrivono solo sotto /esporta, e solo con --esporta/FEBE_ESPORTA e un montaggio (riga di avvio e avviso se manca); sul desktop qualsiasi cartella con la finestra del sistema e lo spazio libero misurato anche sulle condivisioni di rete. La dimostrazione ha una cartella generale, una propria, un account non esportato e copie vere in ogni stato, scritte dal motore nella sua cartella temporanea. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a112c92893
commit
4a7925ad23
30 files changed
+2299
-32
No files matched your search
@@ -316,6 +316,41 @@ public sealed class ExportService : IAsyncDisposable
|
||||
StartJob([], (progress, token) => CheckJobAsync(destination, progress, token));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// «Riprova» of a paused destination: checks it with its probe (WP1.3). Still not writable: it stays paused with the
|
||||
/// new reason, returned. Writable: the pause goes and, when no other long work runs, its paused jobs resume (oldest
|
||||
/// first); otherwise they wait for «Riprendi».
|
||||
/// </summary>
|
||||
/// <exception cref="KeyNotFoundException">No such destination.</exception>
|
||||
/// <exception cref="InvalidOperationException">The destination was retired.</exception>
|
||||
public async Task<ExportRetry> RetryDestinationAsync(long destinationId, CancellationToken ct = default)
|
||||
{
|
||||
var destination = await _env.Storage.Exports.GetDestinationAsync(destinationId, ct).ConfigureAwait(false)
|
||||
?? throw new KeyNotFoundException($"Destinazione di esportazione {destinationId} non trovata.");
|
||||
if (destination.IsRetired)
|
||||
{
|
||||
throw new InvalidOperationException("Questa cartella è stata tolta: non c'è niente da riprovare.");
|
||||
}
|
||||
|
||||
if (await Copier.CheckDestinationAsync(destination, ct).ConfigureAwait(false) is { } problem)
|
||||
{
|
||||
await ExportPause.PauseAsync(_env, destination, problem).ConfigureAwait(false);
|
||||
return new ExportRetry(problem, []);
|
||||
}
|
||||
|
||||
await ExportPause.ClearAsync(_env, destination).ConfigureAwait(false);
|
||||
var paused = (await _env.Storage.Exports.ListUnfinishedRunsAsync(ct).ConfigureAwait(false))
|
||||
.Where(r => r.DestinationId == destinationId && r.State == ExportRunState.Paused)
|
||||
.Select(r => r.Id)
|
||||
.ToList();
|
||||
if (paused.Count == 0 || IsBusy || _env.Gate?.Busy is not null)
|
||||
{
|
||||
return new ExportRetry(null, []);
|
||||
}
|
||||
|
||||
return new ExportRetry(null, await ResumeAsync(paused, ct).ConfigureAwait(false));
|
||||
}
|
||||
|
||||
/// <summary>The progress of the running job, or a snapshot of the newest job.</summary>
|
||||
public async Task<ExportProgress> GetProgressAsync(CancellationToken ct = default)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user