Method CleanAsync
CleanAsync(TimeSpan, CancellationToken)
Cleans up the repository by removing files whose delete markers are older than deleteDelay.
Declaration
public Task CleanAsync(TimeSpan deleteDelay, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| TimeSpan | deleteDelay | The minimum age a delete marker (or a committed delete journal) must reach before its files are physically deleted. Use Zero to delete all marked files immediately. |
| CancellationToken | cancellationToken | A cancellation token that cancels the operation. |
Returns
| Type | Description |
|---|---|
| Task |
Implements
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Another clean operation is already in progress. |
| IOException | A committed delete journal is damaged, or processing a file failed with an unexpected I/O error. The pass carries on with everything else and throws once it has finished: a damaged journal is left in place without deleting the files it lists and is named in the message, and a file that failed is left for the next pass. |
| AggregateException | More than one such failure occurred in the pass. The inner exceptions are the individual failures. |
CleanAsync(TimeSpan, Func<FileId, IndeterminateResolution>?, CancellationToken)
Cleans up the repository by removing files whose delete markers are older than deleteDelay and resolving indeterminate files using
the provided synchronous callback.
Declaration
public Task CleanAsync(TimeSpan deleteDelay, Func<FileId, IndeterminateResolution>? resolveIndeterminateCallback, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| TimeSpan | deleteDelay | The minimum age a delete marker (or a committed delete journal) must reach before its files are physically deleted. Use Zero to delete all marked files immediately. |
| Func<FileId, IndeterminateResolution> | resolveIndeterminateCallback | An optional callback invoked for each indeterminate file encountered during the clean, including each file listed in the journal of a staged transaction that did not finish. Return Keep to clear the indeterminate state and keep the file, or Delete to mark it for deletion. |
| CancellationToken | cancellationToken | A cancellation token that cancels the operation. |
Returns
| Type | Description |
|---|---|
| Task |
Implements
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Another clean operation is already in progress. |
| IOException | A committed delete journal is damaged, or processing a file failed with an unexpected I/O error. The pass carries on with everything else and throws once it has finished: a damaged journal is left in place without deleting the files it lists and is named in the message, and a file that failed is left for the next pass. |
| AggregateException | More than one such failure occurred in the pass. The inner exceptions are the individual failures. |
CleanAsync(TimeSpan, Func<FileId, Task<IndeterminateResolution>>?, CancellationToken)
Cleans up the repository by removing files whose delete markers are older than deleteDelay and resolving indeterminate files using
the provided asynchronous callback.
Declaration
public Task CleanAsync(TimeSpan deleteDelay, Func<FileId, Task<IndeterminateResolution>>? resolveIndeterminateCallback, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| TimeSpan | deleteDelay | The minimum age a delete marker (or a committed delete journal) must reach before its files are physically deleted. Use Zero to delete all marked files immediately. |
| Func<FileId, Task<IndeterminateResolution>> | resolveIndeterminateCallback | An optional callback invoked for each indeterminate file encountered during the clean, including each file listed in the journal of a staged transaction that did not finish. Return Keep to clear the indeterminate state and keep the file, or Delete to mark it for deletion. |
| CancellationToken | cancellationToken | A cancellation token that cancels the operation. |
Returns
| Type | Description |
|---|---|
| Task |
Implements
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Another clean operation is already in progress. |
| IOException | A committed delete journal is damaged, or processing a file failed with an unexpected I/O error. The pass carries on with everything else and throws once it has finished: a damaged journal is left in place without deleting the files it lists and is named in the message, and a file that failed is left for the next pass. |
| AggregateException | More than one such failure occurred in the pass. The inner exceptions are the individual failures. |