Ejemplo n.º 1
0
        public FeedRangeCompositeContinuation(
            string containerRid,
            FeedRangeInternal feedRange,
            IReadOnlyList <Documents.Routing.Range <string> > ranges,
            string continuation = null)
            : this(containerRid, feedRange)
        {
            if (ranges == null)
            {
                throw new ArgumentNullException(nameof(ranges));
            }

            if (ranges.Count == 0)
            {
                throw new ArgumentOutOfRangeException(nameof(ranges));
            }

            foreach (Documents.Routing.Range <string> range in ranges)
            {
                this.CompositeContinuationTokens.Enqueue(
                    FeedRangeCompositeContinuation.CreateCompositeContinuationTokenForRange(
                        range.Min,
                        range.Max,
                        continuation));
            }

            this.CurrentToken = this.CompositeContinuationTokens.Peek();
        }
Ejemplo n.º 2
0
        private void CreateChildRanges(IReadOnlyList <Documents.PartitionKeyRange> keyRanges)
        {
            if (keyRanges == null)
            {
                throw new ArgumentNullException(nameof(keyRanges));
            }

            // Update current
            Documents.PartitionKeyRange firstRange = keyRanges[0];
            this.CurrentToken.Range = new Documents.Routing.Range <string>(firstRange.MinInclusive, firstRange.MaxExclusive, true, false);
            // Add children
            foreach (Documents.PartitionKeyRange keyRange in keyRanges.Skip(1))
            {
                this.CompositeContinuationTokens.Enqueue(
                    FeedRangeCompositeContinuation.CreateCompositeContinuationTokenForRange(
                        keyRange.MinInclusive,
                        keyRange.MaxExclusive,
                        this.CurrentToken.Token));
            }
        }
Ejemplo n.º 3
0
 private void CreateChildRanges(IReadOnlyList <Documents.PartitionKeyRange> keyRanges)
 {
     if (keyRanges == null)
     {
         throw new ArgumentNullException(nameof(keyRanges));
     }
     // Update current
     Documents.PartitionKeyRange firstRange = keyRanges[0];
     this.CurrentToken.Range = new Documents.Routing.Range <string>(firstRange.MinInclusive, firstRange.MaxExclusive, true, false);
     if (FeedRangeCompositeContinuation.TryParseAsCompositeContinuationToken(
             this.CurrentToken.Token,
             out CompositeContinuationToken continuationAsComposite))
     {
         // Update the internal composite continuation
         continuationAsComposite.Range = this.CurrentToken.Range;
         this.CurrentToken.Token       = JsonConvert.SerializeObject(continuationAsComposite);
         // Add children
         foreach (Documents.PartitionKeyRange keyRange in keyRanges.Skip(1))
         {
             continuationAsComposite.Range = keyRange.ToRange();
             this.CompositeContinuationTokens.Enqueue(
                 FeedRangeCompositeContinuation.CreateCompositeContinuationTokenForRange(
                     keyRange.MinInclusive,
                     keyRange.MaxExclusive,
                     JsonConvert.SerializeObject(continuationAsComposite)));
         }
     }
     else
     {
         // Add children
         foreach (Documents.PartitionKeyRange keyRange in keyRanges.Skip(1))
         {
             this.CompositeContinuationTokens.Enqueue(
                 FeedRangeCompositeContinuation.CreateCompositeContinuationTokenForRange(
                     keyRange.MinInclusive,
                     keyRange.MaxExclusive,
                     this.CurrentToken.Token));
         }
     }
 }