Method DeleteVariantsAsync
DeleteVariantsAsync(FileId, params ReadOnlySpan<string>)
Permanently retires the specified variants of a file, automatically preserving any dependent variants the caller did not list.
Declaration
public ValueTask DeleteVariantsAsync(FileId fileId, params ReadOnlySpan<string> variantIds)
Parameters
| Type | Name | Description |
|---|---|---|
| FileId | fileId | The ID of the file whose variants should be retired. |
| ReadOnlySpan<string> | variantIds | The full set of variant IDs the caller owns and wants retired. Duplicates are ignored and ordering is irrelevant. |
Returns
| Type | Description |
|---|---|
| ValueTask |
Remarks
Pass every variant ID you want gone. Any variant that is not listed but depends (via an alias) on a listed variant is automatically preserved: the earliest-created surviving dependent is promoted to a standalone data file and the remaining survivors are re-pointed at it before the listed source is retired. To retire a variant together with its dependents, simply include those dependents in the list.
This API is intended for permanent retirement of variant IDs. Downstream consumers, notably static file hosts serving repo files by URL, typically depend on stable variant identity, and the repository does not provide an atomic delete-then-add "replacement" story. The normal way to update a variant is to add a new variant under a new ID, transition consumers to the new ID, and then retire the old one.
Retirement is visible to fetches immediately: GetVariantAsync(FileId, string) throws RepoFileNotFoundException against a retired variant even while the underlying data file may still linger on disk in deferred-delete mode. Within a single call, every listed variant's retirement is committed (its in-group delete marker written) before any physical teardown begins, so a concurrent fetch never observes a partially-applied subset (modulo the brief window between individual delete marker writes).
Whether physical removal of data files is immediate or deferred is governed by DeleteMode. The method is fully idempotent: an empty list, already-retired variants, fully cleaned-up variants, and never-existed variant IDs are all silently skipped.