Example #1
0
 private ParallelCrossPartitionQueryPipelineStage(
     CrossPartitionRangePageAsyncEnumerator <QueryPage, QueryState> crossPartitionRangePageAsyncEnumerator,
     CancellationToken cancellationToken)
 {
     this.crossPartitionRangePageAsyncEnumerator = crossPartitionRangePageAsyncEnumerator ?? throw new ArgumentNullException(nameof(crossPartitionRangePageAsyncEnumerator));
     this.cancellationToken = cancellationToken;
 }
Example #2
0
 private CrossPartitionChangeFeedAsyncEnumerator(
     CrossPartitionRangePageAsyncEnumerator <ChangeFeedPage, ChangeFeedState> crossPartitionEnumerator,
     CancellationToken cancellationToken)
 {
     this.crossPartitionEnumerator = crossPartitionEnumerator ?? throw new ArgumentNullException(nameof(crossPartitionEnumerator));
     this.cancellationToken        = cancellationToken;
 }
Example #3
0
        public static TryCatch <IQueryPipelineStage> MonadicCreate(
            IDocumentContainer documentContainer,
            SqlQuerySpec sqlQuerySpec,
            IReadOnlyList <FeedRangeEpk> targetRanges,
            Cosmos.PartitionKey?partitionKey,
            int pageSize,
            int maxConcurrency,
            CosmosElement continuationToken,
            CancellationToken cancellationToken)
        {
            if (targetRanges == null)
            {
                throw new ArgumentNullException(nameof(targetRanges));
            }

            if (targetRanges.Count == 0)
            {
                throw new ArgumentException($"{nameof(targetRanges)} must have some elements");
            }

            if (pageSize <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(pageSize));
            }

            TryCatch <CrossFeedRangeState <QueryState> > monadicExtractState = MonadicExtractState(continuationToken, targetRanges);

            if (monadicExtractState.Failed)
            {
                return(TryCatch <IQueryPipelineStage> .FromException(monadicExtractState.Exception));
            }

            CrossFeedRangeState <QueryState> state = monadicExtractState.Result;

            CrossPartitionRangePageAsyncEnumerator <QueryPage, QueryState> crossPartitionPageEnumerator = new CrossPartitionRangePageAsyncEnumerator <QueryPage, QueryState>(
                documentContainer,
                ParallelCrossPartitionQueryPipelineStage.MakeCreateFunction(documentContainer, sqlQuerySpec, pageSize, partitionKey, cancellationToken),
                comparer: Comparer.Singleton,
                maxConcurrency,
                state: state,
                cancellationToken: cancellationToken);

            ParallelCrossPartitionQueryPipelineStage stage = new ParallelCrossPartitionQueryPipelineStage(crossPartitionPageEnumerator, cancellationToken);

            return(TryCatch <IQueryPipelineStage> .FromResult(stage));
        }
 private CrossPartitionReadFeedAsyncEnumerator(
     CrossPartitionRangePageAsyncEnumerator <ReadFeedPage, ReadFeedState> crossPartitionEnumerator)
 {
     this.crossPartitionEnumerator = crossPartitionEnumerator ?? throw new ArgumentNullException(nameof(crossPartitionEnumerator));
 }