mod builder;
mod bulk;
mod chunked;
mod iters;
pub(crate) mod key_math;
mod merge;
mod scan;
#[cfg(all(test, feature = "typed-tree"))]
mod tests;
use crate::key::Key;
use crate::map_index::Dir;
pub use builder::{MappedPage, Scope};
pub use bulk::Progress;
pub use chunked::{ChunkedPage, PageSpec, StopReason, page_chunks};
pub(crate) use iters::DirRangeIter;
pub use iters::{ConstMapKeyIter, ConstMapRowIter, ConstTreeKeyIter, ConstTreeRowIter};
#[cfg(feature = "fjall")]
pub use iters::{LsmKeyIter, LsmRowIter};
#[cfg(feature = "typed-tree")]
pub use iters::{
MapKeyIter, MapRowIter, TreeKeyIter, TreeRowIter, ZeroMapKeyIter, ZeroMapRowIter,
ZeroTreeKeyIter, ZeroTreeRowIter,
};
#[cfg(feature = "var-collections")]
pub use iters::{VarMapKeyIter, VarMapRowIter, VarTreeKeyIter, VarTreeRowIter};
#[cfg(all(feature = "typed-tree", feature = "var-collections"))]
pub use iters::{VarTypedMapKeyIter, VarTypedMapRowIter, VarTypedTreeKeyIter, VarTypedTreeRowIter};
pub use merge::{BoxedRows, CoalescedMerge, MergeSorted, boxed, merge_sorted};
pub use scan::{BulkScan, MapScan, OrderedScan, OwnedRows, StrictRows, TreeScan};
pub(crate) fn tree_scope<'a, C, K: Key, const N: usize>(
coll: &'a C,
key: &K,
storage_dir: Dir,
) -> Scope<'a, TreeScan<&'a C>, N>
where
TreeScan<&'a C>: OrderedScan<Key = K>,
{
let (start, end) = key_math::scope_bounds_n::<K, N>(key);
Scope::from_parts(
TreeScan { coll },
key_math::prefix_key(key, N),
start,
end,
storage_dir,
)
}
pub(crate) fn map_scope<'a, M, K: Key, const N: usize>(
map: &'a M,
key: &K,
storage_dir: Dir,
iterable: bool,
) -> Option<Scope<'a, MapScan<&'a M>, N>>
where
MapScan<&'a M>: OrderedScan<Key = K>,
{
if !iterable {
return None;
}
let (start, end) = key_math::scope_bounds_n::<K, N>(key);
Some(Scope::from_parts(
MapScan { view: map },
key_math::prefix_key(key, N),
start,
end,
storage_dir,
))
}