Exemplo n.º 1
0
		private bool SomeFileOverlapsRange(bool disjointSortedFiles, IList<FileMetadata> files, Slice smallestKey, Slice largestKey)
		{
			var userComparator = storageContext.InternalKeyComparator.UserComparator;

			if (!disjointSortedFiles)
			{
				// Need to check against all files
				return files.Any(file => !AfterFile(userComparator, smallestKey, file) && !BeforeFile(userComparator, largestKey, file));
			}

			var index = 0;
			if (smallestKey.IsEmpty() == false)
			{
				var smallInternalKey = new InternalKey(smallestKey, Format.MaxSequenceNumber, ItemType.ValueForSeek);
				files.TryFindFile(smallInternalKey.TheInternalKey, storageContext.InternalKeyComparator, out index);
			}

			if (index >= files.Count)
			{
				// beginning of range is after all files, so no overlap.
				return false;
			}

			return !BeforeFile(userComparator, largestKey, files[index]);
		}