Skip to main content

MemoryStore

Struct MemoryStore 

Source
pub struct MemoryStore {
    pub sessions: MemorySessionStore,
    pub embeddings: MemoryEmbeddingStore,
    pub artifacts: MemoryArtifactStore,
    pub executions: MemoryExecutionStore,
}
Expand description

A composite in-memory store aggregating all four storage domains with coordinated operations, including cascading deletes.

Provides direct access to each sub-store through public fields for fine-grained control, plus delete_session_cascading() for atomic cross-domain cleanup.

§Example

use behest_store::memory::MemoryStore;

let store = MemoryStore::new();
// Use store.sessions, store.executions, store.embeddings, store.artifacts
// individually, or use store.delete_session_cascading() for full cleanup.

Fields§

§sessions: MemorySessionStore

Session and message storage.

§embeddings: MemoryEmbeddingStore

Embedding storage.

§artifacts: MemoryArtifactStore

Artifact storage.

§executions: MemoryExecutionStore

Tool execution and usage storage.

Implementations§

Source§

impl MemoryStore

Source

pub fn new() -> Self

Creates a new empty composite memory store with all four sub-stores.

Source

pub async fn delete_session_cascading(&self, id: &Uuid) -> StoreResult<()>

Deletes a session and all related data across all sub-stores.

This is semantically equivalent to what a real database would do with foreign-key ON DELETE CASCADE, but across in-memory collections. Collects errors from all sub-stores instead of short-circuiting.

§Errors

Returns StorageError::BackendError aggregating errors from any sub-stores that failed.

Trait Implementations§

Source§

impl Default for MemoryStore

Source§

fn default() -> MemoryStore

Returns the “default value” for a type. Read more

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.