pub struct MemoryEngine { /* private fields */ }Expand description
Everything that outlives a conversation.
Implementations§
Source§impl MemoryEngine
impl MemoryEngine
Sourcepub fn in_memory(user: UserId) -> Self
pub fn in_memory(user: UserId) -> Self
An engine backed entirely by in-process storage.
Suitable for tests, single-node deployments and local development; swap the repository and event log for durable ones in production.
Sourcepub fn new(
user: UserId,
repository: Arc<dyn MemoryRepository>,
events: Arc<dyn MemoryEventLog>,
config: MemoryRuntimeConfig,
) -> Self
pub fn new( user: UserId, repository: Arc<dyn MemoryRepository>, events: Arc<dyn MemoryEventLog>, config: MemoryRuntimeConfig, ) -> Self
An engine over the given repository and event log.
Sourcepub fn with_semantic_fallback(self, fallback: Arc<dyn SemanticFallback>) -> Self
pub fn with_semantic_fallback(self, fallback: Arc<dyn SemanticFallback>) -> Self
Attach a paraphrase-tolerant retrieval backend.
Every session opened afterwards consults it. Without this the seam was
unreachable in practice: LocalMemoryRetriever::with_semantic_fallback
existed, but MemoryEngine::begin_session built the retriever itself
and never called it, so no application could install one.
The backend is asked on both the speculative and the tool path, under
the deadlines in crate::core::RetrievalConfig. A backend slower than
immediate_semantic_timeout_ms simply times out on the tool path and
still contributes through speculation.
Sourcepub fn with_plan_extractor(
self,
extractor: Arc<dyn RetrievalPlanExtractor>,
) -> Self
pub fn with_plan_extractor( self, extractor: Arc<dyn RetrievalPlanExtractor>, ) -> Self
Use a model-backed retrieval-plan extractor.
The extractor is wrapped in a deadline that falls back to the rule-based plan, so an unavailable model degrades retrieval quality rather than stalling the pipeline.
Sourcepub fn with_observation_extractor(
self,
extractor: Arc<dyn MemoryObservationExtractor>,
) -> Self
pub fn with_observation_extractor( self, extractor: Arc<dyn MemoryObservationExtractor>, ) -> Self
Use a model-backed observation extractor, under the configured deadline.
Sourcepub fn repository(&self) -> &Arc<dyn MemoryRepository>
pub fn repository(&self) -> &Arc<dyn MemoryRepository>
The canonical repository.
Sourcepub fn events(&self) -> &Arc<dyn MemoryEventLog>
pub fn events(&self) -> &Arc<dyn MemoryEventLog>
The event log.
Sourcepub fn config(&self) -> &MemoryRuntimeConfig
pub fn config(&self) -> &MemoryRuntimeConfig
Runtime configuration.
Sourcepub async fn compile_index(&self) -> Result<u64, MemoryError>
pub async fn compile_index(&self) -> Result<u64, MemoryError>
Compile the retrieval index from the canonical corpus.
The index is derived and disposable; this rebuilds it from scratch, which is also the recovery path after any index corruption or schema change.
Sourcepub fn begin_session(&self, session_id: SessionId) -> MemorySession
pub fn begin_session(&self, session_id: SessionId) -> MemorySession
Begin a logical conversation.
Sourcepub async fn promote_patterns(&self) -> Result<usize, MemoryError>
pub async fn promote_patterns(&self) -> Result<usize, MemoryError>
Run a promotion sweep over staged patterns.
Auto Trait Implementations§
impl Freeze for MemoryEngine
impl !RefUnwindSafe for MemoryEngine
impl Send for MemoryEngine
impl Sync for MemoryEngine
impl Unpin for MemoryEngine
impl !UnwindSafe for MemoryEngine
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
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].