FulcrumFS FulcrumFS
FulcrumFS FulcrumFS
DocFX + Singulink = ♥

Search Results for

    Method CommitAsync

    CommitAsync(CancellationToken)

    Commits the transaction, making the files it added and deleted permanent in the repository.

    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

    A failure to commit an individual file is not thrown: the file stays accessible in an indeterminate state for the next cleanup pass to resolve, and the failure is reported through TransactionCompletionFailed. Once this method has returned, every file of the transaction is therefore committed or indeterminate, and none has been rolled back.

    What has happened when this method throws depends on the exception. An OperationCanceledException means that nothing has been committed: the transaction is still open and can be committed again. Disposing it instead does not roll it back but leaves its files indeterminate for a cleanup pass to resolve, so once the application's database has committed, pass None, or a cancellation leaves to the cleanup pass what the commit would have finished. Any other exception comes from a TransactionCompletionFailed handler that threw, once every file had been attempted, or from the repository having been disposed. Neither means that the transaction was rolled back: every file is committed or left indeterminate as above, and disposing the transaction rolls nothing back.

    Committing a transaction that has itself been disposed is an error of the caller and throws an ObjectDisposedException as well: the call commits nothing, and a transaction that was disposed without having been committed or rolled back left its files indeterminate when it was disposed.

    Exceptions
    Type Condition
    OperationCanceledException

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

    ObjectDisposedException

    The transaction has been disposed: nothing is committed, and what it had not committed or rolled back was left indeterminate when it was disposed. Or the repository has been disposed: the files that had not been committed yet are left indeterminate.

    © Singulink. All rights reserved.