pub enum Query<'a, K: Key + LayerKey + OrdLowerBound> {
Point(&'a K),
LimitedRange(&'a K),
FullRange(&'a K),
FullScan,
}
Expand description
Query describes the goal of a search in the LSM tree. The caller specifies this to guide the merger on which layer files it must consult. Layers might be skipped during a query for a few reasons:
- Existence filters might allow layer files to be skipped.
- For bounded queries (i.e. any except FullScan), if the search key has MergeType::OptimizedMerge, we can use that to omit older layers once we find a match.
Variants§
Point(&'a K)
Point queries look for a specific key in the LSM tree. In this case, the existence filters
for each layer file can be used to decide if the layer file needs to be consulted.
Note that it is an error to use Point
for range-like keys. Either LimitedRange
or
FullRange
must be used instead.
LimitedRange(&'a K)
LimitedRange queries position the iterator to K::search_key
, and scans forward until the
first record which does not overlap the provided key. In this case, the existence filters
for each layer file can be used, but we have to check for all possible keys in the range we
wish to search. Obviously, that means that the range should be, well, limited. Fuzzy
hashes permit this for extent-like keys, but these queries are not the right choice for
things like searching a directory.
FullRange(&'a K)
FullRange queries position the iterator to a starting key, and scan forward to the first key of a different type. In this case, the existence filters are not used.
FullScan
FullScan queries are intended to yield every record in the tree. In this case, the existence filters are not used.
Trait Implementations§
Auto Trait Implementations§
impl<'a, K> Freeze for Query<'a, K>
impl<'a, K> RefUnwindSafe for Query<'a, K>where
K: RefUnwindSafe,
impl<'a, K> Send for Query<'a, K>
impl<'a, K> Sync for Query<'a, K>
impl<'a, K> Unpin for Query<'a, K>
impl<'a, K> UnwindSafe for Query<'a, K>where
K: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more