E5: il servizio avvia, cede e ferma le copie automatiche
Il servizio delle copie impara le partenze automatiche: TryStartAutomaticAsync e TryResumeAutomaticAsync non lanciano mai eccezioni perché Febe è occupata (occupato, niente da fare senza prendere il cancello, ferme), registrano solo i file da scrivere, un lavoro per cartella, e prendono il cancello con il permesso che cede: «Copia in…», «Riprendi», «Controlla le copie» e «Riprova» lo spostano con EnterAsync e aspettano che abbia salvato i suoi stati. I cambi di cartella passano da ChangeDestinationAsync, serializzati con le partenze automatiche: spegnere «Automatica» ferma subito la copia automatica di quella cartella e annulla i suoi lavori (risposta 52); un lavoro automatico non finito non blocca più il cambio di cartella. La copia annulla da sé un lavoro automatico la cui cartella non è più automatica. «Interrompi» di una copia automatica la ferma per un'ora, in memoria, con «Riprendi ora» (risposta 53). La prova di «Riprova» guarda anche lo spazio per il prossimo file prima di togliere una pausa. «Copia automatica in … finita» solo se il lavoro ha fatto qualcosa (risposta 54). I «Non riuscito» restano candidati di ogni giro (risposta 50); il percorso troppo lungo ha la sua nota. La chiusura aspetta il lavoro al più 10 secondi. Il segnale parte dal nucleo quando una cartella si accende o prende più file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cfd0ef88d7
commit
0f69a01f88
10 files changed
+1872
-123
No files matched your search
@@ -1,3 +1,4 @@
|
||||
using Febe.Core.Abstractions;
|
||||
using Febe.Core.Domain;
|
||||
using Febe.Core.Storage;
|
||||
|
||||
@@ -204,8 +205,40 @@ public sealed record ExportProgress(
|
||||
public double Fraction => BytesTotal > 0
|
||||
? Math.Clamp((double)BytesDone / BytesTotal, 0, 1)
|
||||
: FilesTotal > 0 ? Math.Clamp((double)FilesDone / FilesTotal, 0, 1) : 0;
|
||||
|
||||
/// <summary>
|
||||
/// The kind of <see cref="RunId"/>'s run (tappa E5, D7.8): taken from the run being worked on, not from the job; null
|
||||
/// for «Controlla le copie» and before a run is reached.
|
||||
/// </summary>
|
||||
public ExportRunKind? Kind { get; init; }
|
||||
|
||||
/// <summary>Who started <see cref="RunId"/>'s run: an automatic run resumed with «Riprendi» stays automatic here.</summary>
|
||||
public ExportRunOrigin? Origin { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>What an automatic start did (tappa E5, D7): never an exception because Febe is busy.</summary>
|
||||
public enum AutoExportStartOutcome
|
||||
{
|
||||
/// <summary>A job started: <see cref="AutoExportStart.Runs"/> are its runs.</summary>
|
||||
Started,
|
||||
|
||||
/// <summary>Nothing to copy (or to resume): no lease was taken, no run recorded.</summary>
|
||||
NothingToDo,
|
||||
|
||||
/// <summary>
|
||||
/// Something else comes first: a job, an engine session, a change of destination, other long work
|
||||
/// (<see cref="AutoExportStart.BusyWith"/>), or Alberto's work displaced the start while it planned.
|
||||
/// </summary>
|
||||
Busy,
|
||||
|
||||
/// <summary>«Interrompi» stopped the automatic copies until <c>ExportService.AutomaticHeldUntil</c> (answer 53).</summary>
|
||||
Held,
|
||||
}
|
||||
|
||||
/// <summary>The answer of <c>ExportService.TryStartAutomaticAsync</c> and <c>TryResumeAutomaticAsync</c>.</summary>
|
||||
/// <param name="BusyWith">The long work that holds the gate, when that is why the start is <see cref="AutoExportStartOutcome.Busy"/>.</param>
|
||||
public sealed record AutoExportStart(AutoExportStartOutcome Outcome, IReadOnlyList<ExportRun> Runs, LongWorkKind? BusyWith = null);
|
||||
|
||||
/// <summary>What <c>ExportService.StartAsync</c> did: one run per destination (D6), and the plan it followed.</summary>
|
||||
public sealed record ExportStart(IReadOnlyList<ExportRun> Runs, ExportPlan Plan);
|
||||
|
||||
|
||||
Reference in new issue
Block a user