Method IFileRepo.AddVariantAsync
IFileRepo.AddVariantAsync(FileId, string, IFileProcessingPipelineSelector, CancellationToken)
Adds a new variant (and any nested variants declared by the pipeline) to an existing file. Variants are not transactional: the add is committed by the time it returns.
Declaration
TaskWithProgress<IReadOnlyList<IRepoFile>> IFileRepo.AddVariantAsync(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 pre-order (the top-level variant first, then nested variants in declaration order). A variant stored as an alias (see AliasWhenVariantSourceUnchanged) is included and resolves to the content of its source. |
Implements
Remarks
The returned variants know their sizes without storage access or a network round trip (see GetLengthAsync(CancellationToken)).
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | A variant in the requested tree already exists. |
| RepoVariantPendingCleanupException | A variant in the requested tree was retired and has not been cleaned up yet (a subtype of InvalidOperationException). |
| RepoFileNotFoundException | The file or the source variant does not exist. |
| FileProcessingException | A processor in the pipeline rejected or failed to process the source. |
IFileRepo.AddVariantAsync(FileId, string, string?, IFileProcessingPipelineSelector, CancellationToken)
Adds a new variant (and any nested variants declared by the pipeline) to an existing file. Variants are not transactional: the add is committed by the time it returns.
Declaration
TaskWithProgress<IReadOnlyList<IRepoFile>> IFileRepo.AddVariantAsync(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 pre-order (the top-level variant first, then nested variants in declaration order). A variant stored as an alias (see AliasWhenVariantSourceUnchanged) is included and resolves to the content of its source. |
Implements
Remarks
The returned variants know their sizes without storage access or a network round trip (see GetLengthAsync(CancellationToken)).
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | A variant in the requested tree already exists. |
| RepoVariantPendingCleanupException | A variant in the requested tree was retired and has not been cleaned up yet (a subtype of InvalidOperationException). |
| RepoFileNotFoundException | The file or the source variant does not exist. |
| FileProcessingException | A processor in the pipeline rejected or failed to process the source. |