private void WriteFetchExecutionRange(FetchExecutionRange fetchExecutionRange) { this.WriteBeforeFetchExecutionRange(); this.WriteFetchPartitionKeyRangeId(fetchExecutionRange.PartitionId); this.WriteActivityId(fetchExecutionRange.ActivityId); this.WriteStartTime(fetchExecutionRange.StartTime); this.WriteEndTime(fetchExecutionRange.EndTime); this.WriteFetchDocumentCount(fetchExecutionRange.NumberOfDocuments); this.WriteFetchRetryCount(fetchExecutionRange.RetryCount); this.WriteAfterFetchExecutionRange(); }
/// <summary> /// Updates the most recent end time internally and constructs a new FetchExecutionRange /// </summary> /// <param name="partitionIdentifier">The identifier for the partition.</param> /// <param name="activityId">The activity of the fetch.</param> /// <param name="numberOfDocuments">The number of documents that were fetched for this range.</param> /// <param name="retryCount">The number of times we retried for this fetch execution range.</param> public void EndFetchRange(string partitionIdentifier, string activityId, long numberOfDocuments, long retryCount) { if (this.isFetching) { // Calculating the end time as the construction time and the stopwatch as a delta. this.endTime = this.constructionTime.Add(this.stopwatch.Elapsed); FetchExecutionRange fetchExecutionRange = new FetchExecutionRange( partitionIdentifier, activityId, this.startTime, this.endTime, numberOfDocuments, retryCount); this.fetchExecutionRanges.Add(fetchExecutionRange); this.isFetching = false; } }