FSharp.Azure.Cosmos 1.1.0

Edit this page

Patch Module

Types and nested modules

Type/Module Description

CosmosException

PatchBuilder<'T>

PatchConcurrentResult<'T, 'E>

Represents the result of a concurrent patch operation.

PatchConcurrentlyBuilder<'T, 'E>

Computation expression builder for PatchConcurrentlyOperation{T, E}.

PatchConcurrentlyOperation<'T, 'E>

A patch of an item of type that is computed from the item's current state and applied with optimistic concurrency.

Each attempt reads the item, passes it to Update to compute the patch operations, and applies them only if the item still has the eTag it was read with. After a precondition failure (HTTP 412) the next attempt starts over with a fresh read. is the type of the error the update function can return to stop the operation.

PatchOperation<'T>

PatchResult<'t>

Represents the result of a patch operation.

Functions and values

Function or value Description

executeConcurrentlyAsync ct container operation retryAttempts

Full Usage: executeConcurrentlyAsync ct container operation retryAttempts

Parameters:
    ct : CancellationToken - Cancellation token.
    container : Container - Container that holds the item.
    operation : PatchConcurrentlyOperation<'value, 'error> - Patch operation.
    retryAttempts : int - Number of attempts left, including this one. Values below one make a single attempt.

Returns: Task<CosmosResponse<PatchConcurrentResult<'value, 'error>>>

Reads the item, computes the patch operations with the operation's update function, and applies them with the read eTag, starting over on a precondition failure (HTTP 412) while attempts remain.

ct : CancellationToken

Cancellation token.

container : Container

Container that holds the item.

operation : PatchConcurrentlyOperation<'value, 'error>

Patch operation.

retryAttempts : int

Number of attempts left, including this one. Values below one make a single attempt.

Returns: Task<CosmosResponse<PatchConcurrentResult<'value, 'error>>>

patch

Full Usage: patch

Returns: PatchBuilder<'T>
Returns: PatchBuilder<'T>

patchAndRead

Full Usage: patchAndRead

Returns: PatchBuilder<'T>
Returns: PatchBuilder<'T>

patchConcurrenly

Full Usage: patchConcurrenly

Returns: PatchConcurrentlyBuilder<'T, 'E>

Builds a PatchConcurrentlyOperation{T, E} whose successful result does not include the patched item.

Returns: PatchConcurrentlyBuilder<'T, 'E>

patchConcurrenlyAndRead

Full Usage: patchConcurrenlyAndRead

Returns: PatchConcurrentlyBuilder<'T, 'E>

Builds a PatchConcurrentlyOperation{T, E} whose successful result includes the patched item.

Returns: PatchConcurrentlyBuilder<'T, 'E>

Type extensions

Type extension Description

this.ExecuteAsync

Full Usage: this.ExecuteAsync

Parameters:
Returns: Task<CosmosResponse<PatchResult<'T>>>

Executes a patch operation safely and returns CosmosResponse{PatchResult{T}}.

Requires ETag to be set in PatchItemRequestOptions.

Extended Type: Container

operation : PatchOperation<'T>

Patch operation.

cancellationToken : CancellationToken

Cancellation token.

Returns: Task<CosmosResponse<PatchResult<'T>>>

this.ExecuteConcurrentlyAsync

Full Usage: this.ExecuteConcurrentlyAsync

Parameters:
    operation : PatchConcurrentlyOperation<'T, 'E> - Patch operation.
    maxRetryCount : int - Maximum number of attempts, including the first one, so 1 makes a single attempt without retrying. Must be greater than zero. Default is 10.
    cancellationToken : CancellationToken - Cancellation token.

Returns: Task<CosmosResponse<PatchConcurrentResult<'T, 'E>>>

Executes a patch operation by computing patch operations from the current item and returns CosmosResponse{PatchConcurrentResult{T, E}}.

Extended Type: Container

operation : PatchConcurrentlyOperation<'T, 'E>

Patch operation.

maxRetryCount : int

Maximum number of attempts, including the first one, so 1 makes a single attempt without retrying. Must be greater than zero. Default is 10.

cancellationToken : CancellationToken

Cancellation token.

Returns: Task<CosmosResponse<PatchConcurrentResult<'T, 'E>>>
ArgumentOutOfRangeException Thrown when maxRetryCount is less than one.

this.ExecuteConcurrentlyAsync

Full Usage: this.ExecuteConcurrentlyAsync

Parameters:
Returns: Task<CosmosResponse<PatchConcurrentResult<'T, 'E>>>

Executes a patch operation by computing patch operations from the current item and returns CosmosResponse{PatchConcurrentResult{T, E}}.

Makes at most 10 attempts, including the first one.

Extended Type: Container

operation : PatchConcurrentlyOperation<'T, 'E>

Patch operation.

cancellationToken : CancellationToken

Cancellation token.

Returns: Task<CosmosResponse<PatchConcurrentResult<'T, 'E>>>

this.ExecuteOverwriteAsync

Full Usage: this.ExecuteOverwriteAsync

Parameters:
Returns: Task<CosmosResponse<'Result>>

Executes a patch operation, transforms success or failure, and returns CosmosResponse{T}.

Extended Type: Container

operation : PatchOperation<'T>

Patch operation

success : 'T -> 'Result

Result transform if success

failure : CosmosException -> 'Result

Error transform if failure

cancellationToken : CancellationToken

Cancellation token

Returns: Task<CosmosResponse<'Result>>

this.ExecuteOverwriteAsync

Full Usage: this.ExecuteOverwriteAsync

Parameters:
Returns: Task<CosmosResponse<PatchResult<'T>>>

Executes a patch operation and returns CosmosResponse{PatchResult{T}}.

Extended Type: Container

operation : PatchOperation<'T>

Patch operation.

cancellationToken : CancellationToken

Cancellation token.

Returns: Task<CosmosResponse<PatchResult<'T>>>

this.PlainExecuteAsync

Full Usage: this.PlainExecuteAsync

Parameters:
Returns: Task<ItemResponse<'T>>

Executes a patch operation and returns ItemResponse{T}.

Extended Type: Container

operation : PatchOperation<'T>

Patch operation.

cancellationToken : CancellationToken

Cancellation token.

Returns: Task<ItemResponse<'T>>