pub struct MemoryRetention { /* private fields */ }Expand description
One pass of retention over a database holding the memory tables.
Implementations§
Source§impl MemoryRetention
impl MemoryRetention
pub fn new(pool: SqlitePool, config: MemoryRetentionPolicy) -> Self
Sourcepub fn with_message_log(self, messages: Arc<dyn MessageLog>) -> Self
pub fn with_message_log(self, messages: Arc<dyn MessageLog>) -> Self
Drops indexed messages the host no longer keeps. Without a log, indexed messages stay until their claims and episodes go.
Sourcepub async fn run_all(&self) -> MemoryRetentionStats
pub async fn run_all(&self) -> MemoryRetentionStats
Run every step. One failing does not stop the others.
Sourcepub async fn cleanup_superseded_facts(&self) -> Result<u64>
pub async fn cleanup_superseded_facts(&self) -> Result<u64>
Delete old superseded fact versions. Safety: only deletes facts that have been superseded (replaced by newer version).
Sourcepub async fn cleanup_episodes(&self) -> Result<u64>
pub async fn cleanup_episodes(&self) -> Result<u64>
Delete episodes with recall_count=0 older than cutoff. Safety: preserves episodes that have been recalled (referenced).
Sourcepub async fn cleanup_behavior_patterns(&self) -> Result<u64>
pub async fn cleanup_behavior_patterns(&self) -> Result<u64>
Delete behavior patterns at confidence floor that haven’t been seen recently. Safety: only deletes already-decayed patterns (confidence <= 0.1).
Sourcepub async fn cleanup_procedures(&self) -> Result<u64>
pub async fn cleanup_procedures(&self) -> Result<u64>
Delete zero-success procedures older than cutoff. Safety: preserves any procedure that has succeeded at least once.
Sourcepub async fn cleanup_error_solutions(&self) -> Result<u64>
pub async fn cleanup_error_solutions(&self) -> Result<u64>
Delete net-negative error solutions older than cutoff. Safety: preserves solutions where success_count >= failure_count.
Sourcepub async fn cleanup_derived_memory(&self) -> Result<u64>
pub async fn cleanup_derived_memory(&self) -> Result<u64>
Remove projections whose authoritative source no longer exists. Derived rows are disposable and must not outlive an explicit source deletion.
Auto Trait Implementations§
impl !RefUnwindSafe for MemoryRetention
impl !UnwindSafe for MemoryRetention
impl Forget for MemoryRetention
impl Freeze for MemoryRetention
impl Move for MemoryRetention
impl Send for MemoryRetention
impl Sync for MemoryRetention
impl Unpin for MemoryRetention
impl UnsafeUnpin for MemoryRetention
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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