pub struct MmapReader { /* private fields */ }Expand description
Read-only memory-mapped access to an .amem file.
Implementations§
Source§impl MmapReader
impl MmapReader
Sourcepub fn open(path: &Path) -> AmemResult<Self>
pub fn open(path: &Path) -> AmemResult<Self>
Open an .amem file for memory-mapped read access.
Sourcepub fn header(&self) -> &FileHeader
pub fn header(&self) -> &FileHeader
Get the file header.
Sourcepub fn read_node(&self, id: u64) -> AmemResult<CognitiveEvent>
pub fn read_node(&self, id: u64) -> AmemResult<CognitiveEvent>
Read a single node record by ID (O(1) access).
Sourcepub fn read_content(&self, id: u64) -> AmemResult<String>
pub fn read_content(&self, id: u64) -> AmemResult<String>
Read a node’s content (decompress from content block).
Sourcepub fn read_feature_vec(&self, id: u64) -> AmemResult<Vec<f32>>
pub fn read_feature_vec(&self, id: u64) -> AmemResult<Vec<f32>>
Read a node’s feature vector.
Sourcepub fn read_edges(&self, id: u64) -> AmemResult<Vec<Edge>>
pub fn read_edges(&self, id: u64) -> AmemResult<Vec<Edge>>
Read all edges from a node.
Sourcepub fn read_full_graph(&self) -> AmemResult<MemoryGraph>
pub fn read_full_graph(&self) -> AmemResult<MemoryGraph>
Read the full graph into memory.
Sourcepub fn similarity_to(&self, id: u64, query: &[f32]) -> AmemResult<f32>
pub fn similarity_to(&self, id: u64, query: &[f32]) -> AmemResult<f32>
Compute cosine similarity between a query and a node’s feature vector.
Sourcepub fn batch_similarity(
&self,
query: &[f32],
top_k: usize,
min_similarity: f32,
) -> AmemResult<Vec<SimilarityMatch>>
pub fn batch_similarity( &self, query: &[f32], top_k: usize, min_similarity: f32, ) -> AmemResult<Vec<SimilarityMatch>>
Batch similarity: scan all feature vectors and return top-k matches.
Auto Trait Implementations§
impl Freeze for MmapReader
impl RefUnwindSafe for MmapReader
impl Send for MmapReader
impl Sync for MmapReader
impl Unpin for MmapReader
impl UnsafeUnpin for MmapReader
impl UnwindSafe for MmapReader
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