Class FileRepoTransaction
Represents a transaction for a file repository, allowing changes to be committed or rolled back.
Namespace: FulcrumFS
Assembly: FulcrumFS.Local.dll
Syntax
public sealed class FileRepoTransaction : IFileRepoTransaction, IAsyncDisposable
Remarks
A transaction ends with CommitAsync(CancellationToken) or RollbackAsync(CancellationToken). Disposing it without either does not roll it back: the files it added and the files it deleted are left indeterminate for the cleaner to resolve, because the transaction cannot know whether the application's database committed before it was disposed (see DisposeAsync()).
Properties
| Name | Description |
|---|---|
| Repository | Gets the file repository associated with this transaction. |
Methods
| Name | Description |
|---|---|
| AddAsync(FileStream, bool, IFileProcessingPipelineSelector, CancellationToken) | Adds a new file to the repository with the specified file stream, processing it through the specified file pipeline. |
| AddAsync(Stream, string, bool, IFileProcessingPipelineSelector, CancellationToken) | Adds a new file to the repository with the specified stream and extension, processing it through the specified file pipeline. |
| CommitAsync(CancellationToken) | Commits the transaction, making all file additions and deletion made during the transaction permanent in the repository. |
| DeleteAsync(FileId, CancellationToken) | Deletes an existing or tentatively added file from the repository by its file ID. |
| DisposeAsync() | Disposes the transaction. Changes that were neither committed nor rolled back are not rolled back: the files the transaction added and the files it deleted are left indeterminate for the cleaner to resolve. |
| RollbackAsync(CancellationToken) | Rolls back the transaction, discarding any file additions or deletions made during the transaction. |
| TryDeleteAsync(FileId, CancellationToken) | Deletes an existing or tentatively added file from the repository by its file ID if it exists, and reports whether it did. |
Explicit Interface Implementations
| Name | Description |
|---|---|
| IFileRepoTransaction.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. |
| IFileRepoTransaction.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. |
| IFileRepoTransaction.Repository | Gets the repository the transaction belongs to. |