pub struct MemoriesWatcher { /* private fields */ }Expand description
Reactive filter over MemoriesState. Created via
super::MemoriesAdapter::watch.
Implementations§
Source§impl MemoriesWatcher
impl MemoriesWatcher
Sourcepub fn where_id_in(self, ids: impl IntoIterator<Item = u64>) -> MemoriesWatcher
pub fn where_id_in(self, ids: impl IntoIterator<Item = u64>) -> MemoriesWatcher
Restrict to memories whose id is in the provided collection.
Sourcepub fn where_source(self, source: impl Into<String>) -> MemoriesWatcher
pub fn where_source(self, source: impl Into<String>) -> MemoriesWatcher
Restrict to memories from this source.
Sourcepub fn content_contains(self, needle: impl Into<String>) -> MemoriesWatcher
pub fn content_contains(self, needle: impl Into<String>) -> MemoriesWatcher
Restrict to memories whose content contains needle
(case-insensitive).
Sourcepub fn where_tag(self, tag: impl Into<String>) -> MemoriesWatcher
pub fn where_tag(self, tag: impl Into<String>) -> MemoriesWatcher
Restrict to memories tagged with tag.
Sourcepub fn where_any_tag(
self,
tags: impl IntoIterator<Item = String>,
) -> MemoriesWatcher
pub fn where_any_tag( self, tags: impl IntoIterator<Item = String>, ) -> MemoriesWatcher
Restrict to memories that have AT LEAST ONE of the given tags.
Restrict to memories that have EVERY tag in the given set.
Sourcepub fn where_pinned(self, pinned: bool) -> MemoriesWatcher
pub fn where_pinned(self, pinned: bool) -> MemoriesWatcher
Restrict to pinned (true) or unpinned (false) only.
Sourcepub fn created_after(self, ns: u64) -> MemoriesWatcher
pub fn created_after(self, ns: u64) -> MemoriesWatcher
Restrict to created_ns >= ns (inclusive).
Sourcepub fn created_before(self, ns: u64) -> MemoriesWatcher
pub fn created_before(self, ns: u64) -> MemoriesWatcher
Restrict to created_ns <= ns (inclusive).
Sourcepub fn updated_after(self, ns: u64) -> MemoriesWatcher
pub fn updated_after(self, ns: u64) -> MemoriesWatcher
Restrict to updated_ns >= ns (inclusive).
Sourcepub fn updated_before(self, ns: u64) -> MemoriesWatcher
pub fn updated_before(self, ns: u64) -> MemoriesWatcher
Restrict to updated_ns <= ns (inclusive).
Sourcepub fn order_by(self, order: OrderBy) -> MemoriesWatcher
pub fn order_by(self, order: OrderBy) -> MemoriesWatcher
Order each emitted result set.
Sourcepub fn limit(self, n: usize) -> MemoriesWatcher
pub fn limit(self, n: usize) -> MemoriesWatcher
Truncate each emitted result set to n after ordering.
Sourcepub fn stream(self) -> impl Stream<Item = Vec<Arc<Memory>>> + Send + 'static
pub fn stream(self) -> impl Stream<Item = Vec<Arc<Memory>>> + Send + 'static
Start emitting. The stream yields:
- The current filter result immediately (first element).
- A new result vector on each subsequent fold tick where the filter’s result differs from the previously emitted one.
Backing channel is single-slot: if the consumer falls behind
a fast fold task, intermediate filter results are dropped and
the consumer sees the latest state on the next poll. Same
“drop intermediate, final state is correct” semantic as
crate::adapter::net::cortex::CortexAdapter::changes.
If order_by was not set, the watcher defaults to IdAsc
so Vec-equality dedup is deterministic — otherwise HashMap
iteration order could produce spurious re-emissions.
The stream ends when the adapter’s change stream ends (e.g. when all adapter handles drop and the fold task exits).