pub struct Memtable { /* private fields */ }Expand description
In-memory write buffer, drained into an immutable segment at flush.
Edges live in two BTreeSets sorted exactly the way segments are:
(src, label, dst) forward and (dst, label, src) reverse. Flush is a
straight iteration into CSR runs, and a neighborhood is one contiguous
range scan — the same access shape the segment reader will have.
Implementations§
Source§impl Memtable
impl Memtable
pub fn new() -> Self
pub fn insert_node(&mut self, id: NodeId)
pub fn contains_node(&self, id: NodeId) -> bool
pub fn insert_edge( &mut self, src: NodeId, label: EdgeLabel, dst: NodeId, ) -> Result<()>
Sourcepub fn out(
&self,
src: NodeId,
label: EdgeLabel,
) -> impl Iterator<Item = NodeId> + '_
pub fn out( &self, src: NodeId, label: EdgeLabel, ) -> impl Iterator<Item = NodeId> + '_
Outbound neighbors of src under label, ascending.
Sourcepub fn in(
&self,
dst: NodeId,
label: EdgeLabel,
) -> impl Iterator<Item = NodeId> + '_
pub fn in( &self, dst: NodeId, label: EdgeLabel, ) -> impl Iterator<Item = NodeId> + '_
Inbound neighbors of dst under label, ascending.
pub fn edge_count(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn iter_fwd(
&self,
) -> impl ExactSizeIterator<Item = (NodeId, EdgeLabel, NodeId)> + '_
pub fn iter_fwd( &self, ) -> impl ExactSizeIterator<Item = (NodeId, EdgeLabel, NodeId)> + '_
Flush order: already (src, label, dst)-sorted, one pass to encode.
pub fn iter_rev( &self, ) -> impl ExactSizeIterator<Item = (NodeId, EdgeLabel, NodeId)> + '_
pub fn clear(&mut self)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Memtable
impl RefUnwindSafe for Memtable
impl Send for Memtable
impl Sync for Memtable
impl Unpin for Memtable
impl UnsafeUnpin for Memtable
impl UnwindSafe for Memtable
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
Mutably borrows from an owned value. Read more