Interface IFileRepoTransaction
Represents a transaction for an IFileRepo, which adds and deletes main files and is committed or rolled back as a whole.
Inherited Members
Namespace: FulcrumFS
Assembly: FulcrumFS.dll
Syntax
public interface IFileRepoTransaction : IAsyncDisposable
Remarks
When the files belong to rows in a database, commit the database transaction first and this transaction second. Implementations must keep that ordering safe: a file added by a transaction that did not finish committing stays readable until a cleanup pass resolves it through the callback passed to CleanAsync(TimeSpan, Func<FileId, Task<IndeterminateResolution>>?, CancellationToken), and so does a file whose deletion did not finish committing.
Disposing the transaction rolls it back unless it has been committed.
Properties
| Name | Description |
|---|---|
| Repository | Gets the repository the transaction belongs to. |
Methods
| Name | Description |
|---|---|
| AddAsync(FileStream, bool, IFileProcessingPipelineSelector, CancellationToken) | Adds a new file to the repository from the specified file stream, taking the extension from the stream's file name, and processes it through the specified pipeline. |
| AddAsync(Stream, string, bool, IFileProcessingPipelineSelector, CancellationToken) | Adds a new file to the repository from the specified stream and extension, and processes it through the specified pipeline. |
| CommitAsync(CancellationToken) | Commits the transaction, making the files it added and deleted permanent in the repository. |
| DeleteAsync(FileId, CancellationToken) | Deletes an existing file, or a file added by this transaction, by its file ID. |
| RollbackAsync(CancellationToken) | Rolls back the transaction, discarding the files it added and abandoning the deletions it made. |
| TryDeleteAsync(FileId, CancellationToken) | Deletes an existing file, or a file added by this transaction, by its file ID if it exists, and reports whether it did. |