Skip to main content

llkv_btree/
types.rs

1use crate::{
2    errors::Error,
3    pager::Pager,
4    views::{key_view::KeyRef, node_view::NodeView, value_view::ValueRef},
5};
6use std::sync::Arc;
7
8pub type CursorStepRes<P> = Result<
9    (
10        <P as Pager>::Page,
11        NodeView<P>,
12        usize,
13        Option<<P as Pager>::Id>,
14    ),
15    Error,
16>;
17
18pub type NodeWithNext<P> = (<P as Pager>::Page, NodeView<P>, Option<<P as Pager>::Id>);
19pub type NodeWithNextRes<P> = Result<NodeWithNext<P>, Error>;
20
21/// Zero-copy key/value pair yielded from a page.
22pub type EntryRef<P> = (KeyRef<<P as Pager>::Page>, ValueRef<<P as Pager>::Page>);
23
24/// Result wrapper for `EntryRef`.
25pub type EntryRefRes<P> = Result<EntryRef<P>, Error>;
26
27pub type FramePred = Arc<dyn Fn(&[u8], &[u8]) -> bool + Send + Sync + 'static>;
28
29/// Bytes on the left of the split, the promoted separator key, and the
30/// bytes for the new right leaf.
31pub type LeafSplitParts<K> = (Vec<u8>, K, Vec<u8>);
32
33/// Result wrapper for leaf-split output.
34pub type LeafSplitRes<K> = Result<LeafSplitParts<K>, Error>;