internal CosmosClientContextCore( CosmosClient client, CosmosClientConfiguration clientConfiguration, CosmosJsonSerializer cosmosJsonSerializer, CosmosResponseFactory cosmosResponseFactory, CosmosRequestHandler requestHandler, DocumentClient documentClient, IDocumentQueryClient documentQueryClient) { this.Client = client; this.ClientConfiguration = clientConfiguration; this.JsonSerializer = cosmosJsonSerializer; this.ResponseFactory = cosmosResponseFactory; this.RequestHandler = requestHandler; this.DocumentClient = documentClient; this.DocumentQueryClient = documentQueryClient; }
internal static async Task <T> ProcessResourceOperationAsync <T>( CosmosRequestHandler requestHandler, Uri resourceUri, ResourceType resourceType, OperationType operationType, CosmosRequestOptions requestOptions, CosmosContainerCore cosmosContainerCore, Object partitionKey, Stream streamPayload, Action <CosmosRequestMessage> requestEnricher, Func <CosmosResponseMessage, T> responseCreator, CancellationToken cancellationToken) { if (requestHandler == null) { throw new ArgumentException(nameof(requestHandler)); } if (resourceUri == null) { throw new ArgumentNullException(nameof(resourceUri)); } if (responseCreator == null) { throw new ArgumentNullException(nameof(responseCreator)); } CosmosRequestMessage request = await ExecUtils.GenerateCosmosRequestMessage( resourceUri, resourceType, operationType, requestOptions, cosmosContainerCore, partitionKey, streamPayload, requestEnricher); CosmosResponseMessage response = await requestHandler.SendAsync(request, cancellationToken); return(responseCreator(response)); }
public ClientPipelineBuilder( CosmosClient client, IRetryPolicyFactory retryPolicyFactory, ReadOnlyCollection <CosmosRequestHandler> customHandlers) { this.client = client; this.transportHandler = new TransportHandler(client); Debug.Assert(this.transportHandler.InnerHandler == null, nameof(this.transportHandler)); this.partitionKeyRangeGoneRetryHandler = new PartitionKeyRangeGoneRetryHandler(this.client); Debug.Assert(this.partitionKeyRangeGoneRetryHandler.InnerHandler == null, "The partitionKeyRangeGoneRetryHandler.InnerHandler must be null to allow other handlers to be linked."); this.invalidPartitionExceptionRetryHandler = new NamedCacheRetryHandler(this.client); Debug.Assert(this.invalidPartitionExceptionRetryHandler.InnerHandler == null, "The invalidPartitionExceptionRetryHandler.InnerHandler must be null to allow other handlers to be linked."); this.PartitionKeyRangeHandler = new PartitionKeyRangeHandler(client); Debug.Assert(this.PartitionKeyRangeHandler.InnerHandler == null, "The PartitionKeyRangeHandler.InnerHandler must be null to allow other handlers to be linked."); this.UseRetryPolicy(retryPolicyFactory); this.AddCustomHandlers(customHandlers); }
internal static async Task <CosmosResponseMessage> ProcessResourceOperationStreamAsync( CosmosRequestHandler requestHandler, Uri resourceUri, ResourceType resourceType, OperationType operationType, CosmosRequestOptions requestOptions, CosmosContainerCore cosmosContainerCore, Object partitionKey, Stream streamPayload, Action <CosmosRequestMessage> requestEnricher, CancellationToken cancellationToken) { CosmosRequestMessage request = await ExecUtils.GenerateCosmosRequestMessage( resourceUri, resourceType, operationType, requestOptions, cosmosContainerCore, partitionKey, streamPayload, requestEnricher); return(await requestHandler.SendAsync(request, cancellationToken)); }