Skip to main content

MemorySister

Struct MemorySister 

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

Contracts-compliant Memory sister.

Wraps MemoryGraph + engines and implements all v0.2.0 traits. This is the canonical “Memory as a sister” interface.

Implementations§

Source§

impl MemorySister

Source

pub fn from_graph(graph: MemoryGraph, file_path: Option<PathBuf>) -> Self

Create from an existing graph (for migration from SessionManager).

Source

pub fn graph(&self) -> &MemoryGraph

Get a reference to the underlying graph.

Source

pub fn graph_mut(&mut self) -> &mut MemoryGraph

Get a mutable reference to the underlying graph.

Source

pub fn query_engine(&self) -> &QueryEngine

Get the query engine.

Source

pub fn write_engine(&self) -> &WriteEngine

Get the write engine.

Source

pub fn current_session_id(&self) -> Option<u32>

Get the current u32 session ID (for interop with existing code).

Trait Implementations§

Source§

impl FileFormatReader for MemorySister

Available on crate feature format only.
Source§

fn read_file(path: &Path) -> SisterResult<Self>

Read a file with version handling
Source§

fn can_read(path: &Path) -> SisterResult<FileInfo>

Check if a file is readable (without full parse). Returns file info for quick inspection
Source§

fn file_version(path: &Path) -> SisterResult<Version>

Get file version without full parse
Source§

fn migrate(_data: &[u8], _from_version: Version) -> SisterResult<Vec<u8>>

Migrate old version data to current format (in memory). Returns the migrated bytes
Source§

impl FileFormatWriter for MemorySister

Available on crate feature format only.
Source§

fn write_file(&self, path: &Path) -> SisterResult<()>

Write to a file path
Source§

fn to_bytes(&self) -> SisterResult<Vec<u8>>

Serialize the content to bytes
Source§

impl Grounding for MemorySister

Source§

fn ground(&self, claim: &str) -> SisterResult<GroundingResult>

Verify a claim against stored evidence. Read more
Source§

fn evidence( &self, query: &str, max_results: usize, ) -> SisterResult<Vec<EvidenceDetail>>

Get detailed evidence for a query. Read more
Source§

fn suggest( &self, query: &str, limit: usize, ) -> SisterResult<Vec<GroundingSuggestion>>

Find similar items when an exact match fails. Read more
Source§

impl Queryable for MemorySister

Source§

fn query(&self, query: Query) -> SisterResult<QueryResult>

Execute a query.
Source§

fn supports_query(&self, query_type: &str) -> bool

Check if a query type is supported.
Source§

fn query_types(&self) -> Vec<QueryTypeInfo>

List supported query types.
Source§

fn search(&self, text: &str) -> Result<QueryResult, SisterError>

Execute a simple search query.
Source§

fn recent(&self, count: usize) -> Result<QueryResult, SisterError>

Get recent items.
Source§

fn list(&self, limit: usize, offset: usize) -> Result<QueryResult, SisterError>

List items with pagination.
Source§

impl SessionManagement for MemorySister

Source§

fn start_session(&mut self, name: &str) -> SisterResult<ContextId>

Start a new session. Returns the session ID. The previous session (if any) is automatically ended
Source§

fn end_session(&mut self) -> SisterResult<()>

End the current session. After this, a new session must be started before operations
Source§

fn current_session(&self) -> Option<ContextId>

Get the current session ID. Returns None if no session is active
Source§

fn current_session_info(&self) -> SisterResult<ContextInfo>

Get info about the current session
Source§

fn list_sessions(&self) -> SisterResult<Vec<ContextSummary>>

List all past sessions (most recent first)
Source§

fn export_session(&self, id: ContextId) -> SisterResult<ContextSnapshot>

Export a session as a snapshot (for backup/transfer)
Source§

fn import_session( &mut self, snapshot: ContextSnapshot, ) -> SisterResult<ContextId>

Import a session from a snapshot
Source§

fn start_session_with_metadata( &mut self, name: &str, metadata: HashMap<String, Value>, ) -> Result<ContextId, SisterError>

Start a new session with metadata
Source§

fn get_session_info(&self, id: ContextId) -> Result<ContextInfo, SisterError>

Get info about a specific past session
Source§

impl Sister for MemorySister

Source§

const SISTER_TYPE: SisterType = SisterType::Memory

The type of this sister
Source§

const FILE_EXTENSION: &'static str = "amem"

File extension for this sister’s format (without dot)
Source§

fn init(config: SisterConfig) -> SisterResult<Self>
where Self: Sized,

Initialize the sister with configuration
Source§

fn health(&self) -> HealthStatus

Check health status
Source§

fn version(&self) -> Version

Get current version
Source§

fn shutdown(&mut self) -> SisterResult<()>

Shutdown gracefully
Source§

fn capabilities(&self) -> Vec<Capability>

Get capabilities this sister provides
Source§

fn sister_type(&self) -> SisterType

Get the sister type
Source§

fn file_extension(&self) -> &'static str

Get the file extension
Source§

fn is_healthy(&self) -> bool

Check if the sister is healthy
Source§

fn name(&self) -> String

Get a human-readable name
Source§

fn mcp_prefix(&self) -> &'static str

Get MCP tool prefix

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.