public static ChangeFeedIteratorCore Create(
            ContainerInternal container,
            FeedRangeInternal feedRangeInternal,
            string continuation,
            ChangeFeedRequestOptions changeFeedRequestOptions)
        {
            if (!string.IsNullOrEmpty(continuation))
            {
                if (FeedRangeContinuation.TryParse(continuation, out FeedRangeContinuation feedRangeContinuation))
                {
                    return(new ChangeFeedIteratorCore(container, feedRangeContinuation, changeFeedRequestOptions));
                }
                else
                {
                    throw new ArgumentException(string.Format(ClientResources.FeedToken_UnknownFormat, continuation));
                }
            }

            feedRangeInternal = feedRangeInternal ?? FeedRangeEPK.ForCompleteRange();
            return(new ChangeFeedIteratorCore(container, feedRangeInternal, changeFeedRequestOptions));
        }
示例#2
0
        public static bool TryParse(
            JObject jObject,
            JsonSerializer serializer,
            out FeedRangeInternal feedRangeInternal)
        {
            if (FeedRangeEPK.TryParse(jObject, serializer, out feedRangeInternal))
            {
                return(true);
            }

            if (FeedRangePartitionKey.TryParse(jObject, serializer, out feedRangeInternal))
            {
                return(true);
            }

            if (FeedRangePartitionKeyRange.TryParse(jObject, serializer, out feedRangeInternal))
            {
                return(true);
            }

            feedRangeInternal = null;
            return(false);
        }
        public async Task <IReadOnlyList <Documents.Routing.Range <string> > > VisitAsync(FeedRangeEPK feedRange, CancellationToken cancellationToken = default)
        {
            Routing.PartitionKeyRangeCache partitionKeyRangeCache = await this.container.ClientContext.DocumentClient.GetPartitionKeyRangeCacheAsync();

            IReadOnlyList <PartitionKeyRange> pkRanges = await partitionKeyRangeCache.TryGetOverlappingRangesAsync(
                collectionRid : await this.container.GetRIDAsync(cancellationToken),
                range : feedRange.Range,
                forceRefresh : false);

            return(pkRanges.Select(pkRange => pkRange.ToRange()).ToList());
        }
示例#4
0
 public void Visit(FeedRangeEPK feedRange)
 {
     // No-op since the range is defined by the composite continuation token
 }