Raven.Database.Prefetching.PrefetchingBehavior.TryGetDocumentsFromQueue C# (CSharp) Méthode

TryGetDocumentsFromQueue() private méthode

private TryGetDocumentsFromQueue ( Etag nextDocEtag, List &items ) : bool
nextDocEtag Raven.Abstractions.Util.Etag
items List
Résultat bool
		private bool TryGetDocumentsFromQueue(Etag nextDocEtag, ref List<JsonDocument> items)
		{
			JsonDocument result;

			nextDocEtag = HandleEtagGapsIfNeeded(nextDocEtag);
			bool hasDocs = false;

			while (items.Count < autoTuner.NumberOfItemsToIndexInSingleBatch && prefetchingQueue.TryPeek(out result) && nextDocEtag.CompareTo(result.Etag) >= 0)
			{
				// safe to do peek then dequeue because we are the only one doing the dequeues
				// and here we are single threaded
				prefetchingQueue.TryDequeue(out result);

				if (result.Etag != nextDocEtag)
					continue;

				items.Add(result);
				hasDocs = true;

				nextDocEtag = EtagUtil.Increment(nextDocEtag, 1);
				nextDocEtag = HandleEtagGapsIfNeeded(nextDocEtag);
			}

			return hasDocs;
		}