pub struct GraphStorage(/* private fields */);Expand description
Graph storage backend for HNSW index
Wraps NeighborLists for in-memory neighbor storage.
Persistence is handled externally by .omen format serialization.
Implementations§
Source§impl GraphStorage
impl GraphStorage
Sourcepub fn with_capacity(num_nodes: usize, max_levels: usize, m: usize) -> Self
pub fn with_capacity(num_nodes: usize, max_levels: usize, m: usize) -> Self
Create storage with pre-allocated capacity
Sourcepub fn from_neighbor_lists(lists: NeighborLists) -> Self
pub fn from_neighbor_lists(lists: NeighborLists) -> Self
Create from existing neighbor lists (used when loading from persistence)
Sourcepub fn get_neighbors(&self, node_id: u32, level: u8) -> Vec<u32>
pub fn get_neighbors(&self, node_id: u32, level: u8) -> Vec<u32>
Get neighbors for a node at a specific level
Sourcepub fn with_neighbors<F, R>(&self, node_id: u32, level: u8, f: F) -> R
pub fn with_neighbors<F, R>(&self, node_id: u32, level: u8, f: F) -> R
Execute closure with read access to neighbors (zero-copy)
Sourcepub fn set_neighbors(&mut self, node_id: u32, level: u8, neighbors: Vec<u32>)
pub fn set_neighbors(&mut self, node_id: u32, level: u8, neighbors: Vec<u32>)
Set neighbors for a node at a specific level
Sourcepub fn add_bidirectional_link(&mut self, node_a: u32, node_b: u32, level: u8)
pub fn add_bidirectional_link(&mut self, node_a: u32, node_b: u32, level: u8)
Add bidirectional link between two nodes
Sourcepub fn add_bidirectional_link_parallel(
&self,
node_a: u32,
node_b: u32,
level: u8,
)
pub fn add_bidirectional_link_parallel( &self, node_a: u32, node_b: u32, level: u8, )
Add bidirectional link (parallel version)
Sourcepub fn remove_link_parallel(&self, node_a: u32, node_b: u32, level: u8)
pub fn remove_link_parallel(&self, node_a: u32, node_b: u32, level: u8)
Remove unidirectional link (parallel version)
Sourcepub fn set_neighbors_parallel(
&self,
node_id: u32,
level: u8,
neighbors: Vec<u32>,
)
pub fn set_neighbors_parallel( &self, node_id: u32, level: u8, neighbors: Vec<u32>, )
Set neighbors (parallel version)
Sourcepub fn memory_usage(&self) -> usize
pub fn memory_usage(&self) -> usize
Get memory usage in bytes
Trait Implementations§
Source§impl Debug for GraphStorage
impl Debug for GraphStorage
Source§impl<'de> Deserialize<'de> for GraphStorage
impl<'de> Deserialize<'de> for GraphStorage
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for GraphStorage
impl !RefUnwindSafe for GraphStorage
impl Send for GraphStorage
impl Sync for GraphStorage
impl Unpin for GraphStorage
impl UnwindSafe for GraphStorage
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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