pub struct MemoryBus { /* private fields */ }Expand description
Central memory facade used by the runtime.
Implementations§
Source§impl MemoryBus
impl MemoryBus
Sourcepub fn builder(config: VolatileConfig) -> MemoryBusBuilder
pub fn builder(config: VolatileConfig) -> MemoryBusBuilder
Creates a builder for a memory bus.
Sourcepub fn volatile(&self) -> &Arc<VolatileMemory>
pub fn volatile(&self) -> &Arc<VolatileMemory>
Returns the underlying volatile store.
Sourcepub fn vector_store(&self) -> Option<&Arc<dyn VectorStoreClient>>
pub fn vector_store(&self) -> Option<&Arc<dyn VectorStoreClient>>
Returns the configured vector store, if present.
Sourcepub async fn record(&self, record: MemoryRecord) -> MemoryResult<()>
pub async fn record(&self, record: MemoryRecord) -> MemoryResult<()>
Persists a record across all configured stores.
§Errors
Returns MemoryError when writing to the journal or vector store
fails.
Sourcepub async fn recent(&self, limit: usize) -> Vec<MemoryRecord>
pub async fn recent(&self, limit: usize) -> Vec<MemoryRecord>
Returns recent records from volatile memory.
Sourcepub async fn journal_tail(
&self,
limit: usize,
) -> MemoryResult<Vec<MemoryRecord>>
pub async fn journal_tail( &self, limit: usize, ) -> MemoryResult<Vec<MemoryRecord>>
Reads the tail of the journal.
§Errors
Returns MemoryError when reading or decoding entries from the
journal fails.
Sourcepub async fn recall(&self, query: VectorQuery) -> MemoryResult<Vec<VectorMatch>>
pub async fn recall(&self, query: VectorQuery) -> MemoryResult<Vec<VectorMatch>>
Queries the configured vector store.
§Errors
Returns MemoryError::MissingVectorStore when the bus was not
initialised with a vector store implementation.
Sourcepub async fn stats(&self) -> VolatileStats
pub async fn stats(&self) -> VolatileStats
Returns utilisation statistics for the volatile store.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MemoryBus
impl !RefUnwindSafe for MemoryBus
impl Send for MemoryBus
impl Sync for MemoryBus
impl Unpin for MemoryBus
impl !UnwindSafe for MemoryBus
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