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. A failure to commit an individual file is not thrown but reported through TransactionCompletionFailed, as for an ordinary transaction, leaving the file for the cleaner. A deletion that the step has committed and that cannot be applied at once is not a failure and is not reported: a cleanup pass carries it out.

    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 the call can be made again. Disposing the transaction instead does not roll it back but leaves its files for a cleanup pass to resolve through the resolution callback. Pass None here, or a cancellation leaves to the cleanup pass what the commit would have finished.

    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.