FulcrumFS FulcrumFS
FulcrumFS FulcrumFS
DocFX + Singulink = ♥

Search Results for

    Method DeleteAsync

    DeleteAsync(FileId, CancellationToken)

    Deletes an existing or tentatively added file from the repository by its file ID.

    Declaration
    public Task DeleteAsync(FileId fileId, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    FileId fileId

    The ID of the file to delete.

    CancellationToken cancellationToken

    A cancellation token that cancels the operation.

    Returns
    Type Description
    Task
    Implements
    IFileRepoStagedTransaction.DeleteAsync(FileId, CancellationToken)
    Remarks

    The file must exist when this method is called, but nothing is written to the repository: the deletion is recorded in memory and written to the transaction's journal by StageAsync(CancellationToken).

    Use this method when the application believes the file exists, so that a mismatch (a stale reference, or a referenced file that is missing) surfaces as an exception. To delete a file that may already be gone, for example when retrying or replaying work that may already have run, use TryDeleteAsync(FileId, CancellationToken) instead.

    Deleting a file that was added by this transaction discards the add. Deleting a file that this transaction has already deleted or discarded does nothing.

    Deleting a file that another transaction has also deleted succeeds, including when that deletion has committed and the file is pending cleanup: the deletions converge in every DeleteMode, whichever kind of transaction made them. Only a file that is gone, or never existed, throws.

    A file that another transaction has added and not committed yet exists, and its deletion is recorded like any other. On a repository with delete journals it wins: once this transaction has committed, the file is deleted (in Immediate mode by the commit itself) whatever the adding transaction does afterwards, and that transaction's commit succeeds without bringing the file back. On a version 1 repository, where staging writes the file's indeterminate marker, StageAsync(CancellationToken) waits briefly for that marker while the adding transaction holds it, and throws a RepoFileBusyException if it is still in use then.

    Exceptions
    Type Condition
    RepoFileNotFoundException

    The file was not found in the repository: it never existed, or its deletion has already been carried out.

    InvalidOperationException

    The transaction has been staged or rolled back.

    © Singulink. All rights reserved.