Class RecoveryService
- Namespace
- Archiver.Core.Services
- Assembly
- Archiver.Core.dll
PAR2 recovery data next to an archive: what is there, and repair from it (T-F275 step 4). The checks themselves are TestAsync(IReadOnlyList<string>, IProgress<ProgressReport>?, Func<PasswordPromptInfo, Task<PasswordDecision>>?, bool, CancellationToken).
public sealed class RecoveryService : IRecoveryService
- Inheritance
-
RecoveryService
- Implements
- Inherited Members
Constructors
RecoveryService(GroupPolicyOptions, Func<Task<IExtractionRouter>>)
router tests a ZIP the set calls damaged, as the test does.
public RecoveryService(GroupPolicyOptions policy, Func<Task<IExtractionRouter>> router)
Parameters
policyGroupPolicyOptionsrouterFunc<Task<IExtractionRouter>>
Methods
FindArchive(string, CancellationToken)
The file the set of par2Path protects, chosen as the test chooses it: by
the hashes in the set, never by a name alone. A file that is gone is still named when the
set names it. Reads the set, so a UI calls it off its thread. Never throws except
OperationCanceledException.
public RecoveryTarget FindArchive(string par2Path, CancellationToken cancellationToken = default)
Parameters
par2PathstringcancellationTokenCancellationToken
Returns
HasFilesFor(string)
Whether PAR2 files lie next to archivePath under either name the test
looks for (a.zip.par2, a.par2, their volumes). Says nothing about whether they
are usable or meant for this archive. Reads a folder listing, so a UI calls it off its
thread. False under DisableRecoveryData and for a path or
folder that cannot be read; never throws.
public bool HasFilesFor(string archivePath)
Parameters
archivePathstring
Returns
RepairAsync(RepairOptions, IProgress<ProgressReport>?, CancellationToken)
Rebuilds each damaged archive into a new file, <name>.repaired<extension>, next
to it or in OutputDirectory. The archive and its PAR2 files are
only read. An archive is rebuilt exactly when
TestAsync(IReadOnlyList<string>, IProgress<ProgressReport>?, Func<PasswordPromptInfo, Task<PasswordDecision>>?, bool, CancellationToken) with verifyRecoveryData would call it
damaged and repairable; a copy is kept only after it matches the set's hashes.
CreatedFiles lists the repaired copies and RecoveryChecks what was found for each archive. An archive with no usable recovery data is an error here, since repair was asked for. Under DisableRecoveryData every path is refused. Never throws except OperationCanceledException.
public Task<ArchiveResult> RepairAsync(RepairOptions options, IProgress<ProgressReport>? progress = null, CancellationToken cancellationToken = default)
Parameters
optionsRepairOptionsprogressIProgress<ProgressReport>cancellationTokenCancellationToken