Skip to main content

MmapReader

Struct MmapReader 

Source
pub struct MmapReader { /* private fields */ }
Expand description

Read-only memory-mapped access to an .amem file.

Implementations§

Source§

impl MmapReader

Source

pub fn open(path: &Path) -> AmemResult<Self>

Open an .amem file for memory-mapped read access.

Source

pub fn header(&self) -> &FileHeader

Get the file header.

Source

pub fn read_node(&self, id: u64) -> AmemResult<CognitiveEvent>

Read a single node record by ID (O(1) access).

Source

pub fn read_content(&self, id: u64) -> AmemResult<String>

Read a node’s content (decompress from content block).

Source

pub fn read_feature_vec(&self, id: u64) -> AmemResult<Vec<f32>>

Read a node’s feature vector.

Source

pub fn read_edges(&self, id: u64) -> AmemResult<Vec<Edge>>

Read all edges from a node.

Source

pub fn read_full_graph(&self) -> AmemResult<MemoryGraph>

Read the full graph into memory.

Source

pub fn similarity_to(&self, id: u64, query: &[f32]) -> AmemResult<f32>

Compute cosine similarity between a query and a node’s feature vector.

Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.