FulcrumFS FulcrumFS
FulcrumFS FulcrumFS
DocFX + Singulink = ♥

Search Results for

    Method CommitAsync

    CommitAsync(CancellationToken)

    Commits the staged transaction, making the files it added and deleted permanent in the repository. Call this after the application's database has committed.

    Declaration
    Task CommitAsync(CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    CancellationToken cancellationToken

    A cancellation token that cancels the call before the commit has started. A commit that has started is not interrupted.

    Returns
    Type Description
    Task
    Remarks

    The deletions are committed first, in a single atomic step however many files they cover. A failure of that step is thrown: no added file has been committed and no deletion applied in that case, and the call can be made again. Once the step has succeeded, the added files are committed and the deletions are applied according to DeleteMode, and failures of individual files are not thrown but reported through TransactionCompletionFailed, as for an ordinary transaction, leaving the affected files for the cleaner.

    Calling this method again after it succeeded does nothing. The transaction is never rolled back once this method has started the commit, even if it then throws: the application's database has committed, so disposing the transaction leaves its files for a cleanup pass, which resolves them through the resolution callback or, if the step that commits the deletions had taken effect before it failed, carries the deletions out. An exception that a TransactionCompletionFailed handler throws propagates once the transaction is committed, and changes nothing about that.

    An OperationCanceledException is different: it means that the commit was not started, so the transaction is still staged, and disposing it rolls it back. Pass None here, or a cancellation could discard deletions that the database has committed.

    Exceptions
    Type Condition
    IOException

    The deletions could not be committed.

    OperationCanceledException

    The token was cancelled before the commit had started. Nothing has been committed.

    InvalidOperationException

    The transaction has been rolled back.

    ObjectDisposedException

    The transaction was disposed before the stage was committed.

    © Singulink. All rights reserved.