Method IFileRepo.TryAddVariantAsync
IFileRepo.TryAddVariantAsync(FileId, string, IFileProcessingPipelineSelector, CancellationToken)
Tries to add a new variant (and any nested variants declared by the pipeline) to an existing file. The operation is all-or-nothing: it returns null without adding anything if any variant ID in the tree already exists or is being added concurrently.
Declaration
TaskWithProgress<IReadOnlyList<IRepoFile>?> IFileRepo.TryAddVariantAsync(FileId fileId, string variantId, IFileProcessingPipelineSelector pipeline, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| FileId | fileId | The ID of the main file to which the variant is added. |
| string | variantId | The ID of the top-level variant to add. |
| IFileProcessingPipelineSelector | pipeline | The processing pipeline for the top-level variant, or the selector that chooses one by extension. |
| CancellationToken | cancellationToken | A cancellation token that cancels the operation. |
Returns
| Type | Description |
|---|---|
| TaskWithProgress<IReadOnlyList<IRepoFile>> | The stored variants in the same order as AddVariantAsync(FileId, string, string?, IFileProcessingPipelineSelector, CancellationToken), or null if nothing was added. |
Implements
Remarks
The returned variants know their sizes without storage access or a network round trip (see GetLengthAsync(CancellationToken)).
Exceptions
| Type | Condition |
|---|---|
| RepoVariantPendingCleanupException | A variant in the requested tree was retired and has not been cleaned up yet. |
| RepoFileNotFoundException | The file or the source variant does not exist. |
| FileProcessingException | A processor in the pipeline rejected or failed to process the source. |
IFileRepo.TryAddVariantAsync(FileId, string, string?, IFileProcessingPipelineSelector, CancellationToken)
Tries to add a new variant (and any nested variants declared by the pipeline) to an existing file. The operation is all-or-nothing: it returns null without adding anything if any variant ID in the tree already exists or is being added concurrently.
Declaration
TaskWithProgress<IReadOnlyList<IRepoFile>?> IFileRepo.TryAddVariantAsync(FileId fileId, string variantId, string? sourceVariantId, IFileProcessingPipelineSelector pipeline, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| FileId | fileId | The ID of the main file to which the variant is added. |
| string | variantId | The ID of the top-level variant to add. |
| string | sourceVariantId | The ID of the variant to process, or null to process the main file. |
| IFileProcessingPipelineSelector | pipeline | The processing pipeline for the top-level variant, or the selector that chooses one by extension. |
| CancellationToken | cancellationToken | A cancellation token that cancels the operation. |
Returns
| Type | Description |
|---|---|
| TaskWithProgress<IReadOnlyList<IRepoFile>> | The stored variants in the same order as AddVariantAsync(FileId, string, string?, IFileProcessingPipelineSelector, CancellationToken), or null if nothing was added. |
Implements
Remarks
The returned variants know their sizes without storage access or a network round trip (see GetLengthAsync(CancellationToken)).
Exceptions
| Type | Condition |
|---|---|
| RepoVariantPendingCleanupException | A variant in the requested tree was retired and has not been cleaned up yet. |
| RepoFileNotFoundException | The file or the source variant does not exist. |
| FileProcessingException | A processor in the pipeline rejected or failed to process the source. |