Skip to main content

redact_asset

Function redact_asset 

Source
pub async fn redact_asset(
    client: &UploadClient,
    asset_id: &str,
) -> Result<Redaction, UploadError>
Expand description

Abort every open upload session this account holds for asset_id: the network half of redacting an asset deleted before its upload finished (Organization — Deletion State Machine).

The sessions come from GET /upload/sessions, filtered by the asset each names, so a session a previous run left behind (a staged tier that never finished, a push killed mid-ladder) is found without any client-side state. A session the listing names as terminal (completed, failed_processing) is skipped: its outcome is decided and it is neither cancelled nor finalizing. Each other session is cancelled with DELETE /upload/{id}:

  • 204 or 404 is a cancelled session: its staged bytes and quota reservation are released.
  • 409 error.upload.session_not_active is the race with a finalization that started before the abort reached it. Finalization is not interruptible, so that blob lands; the session is reported in Redaction::finalizing and the caller’s delete supersedes the create.

Any other answer fails the redaction. Re-running it is safe: a session already cancelled is a 404, and the listing no longer names it.

Pending tiers need no call: a deferred tier has no session, and a push of a trashed asset plans nothing, so the abort is the whole of what the server has to forget.