pub enum HistoryRetention {
Archive(ArchiveConfig),
ContextOnly,
}Expand description
Policy governing how compacted session history is retained in memory and on disk.
Orthogonal to persistence (session_store):
Self::Archive(the default) retains compacted history cleanly:- When a
session_storeis attached, compaction always rotates turns<= compacted_throughout of hot memory and livejournal.jsonlinto<session_dir>/archive/seg_NNNN.jsonl(plus a unified deterministic Markdown archiveseg_NNNN.md+INDEX.mdwhen enabled), keeping startup and hot RAM bounded. By default there is no segment or byte cap, so full history is preserved; optionalmax_segments/max_bytescaps enable rolling eviction and orphan image GC for long-lived bots. - When no
session_storeis attached, nothing is written to disk and turns stay in memory so history is not silently discarded.
- When a
Self::ContextOnlyretains only the active post-compaction tail and checkpoint summary: prunes compacted turns from hot memory, rewritesjournal.jsonlwhen persisted, deletes unreferenced sidecar images, and writes noarchive/files.
Variants§
Archive(ArchiveConfig)
Rotate compacted segments into <session_dir>/archive/ when persisted
(unbounded by default; optionally capped via ArchiveConfig).
ContextOnly
Retain only the active post-compaction tail and compacted checkpoint summary.
Implementations§
Source§impl HistoryRetention
impl HistoryRetention
Sourcepub const fn archive() -> Self
pub const fn archive() -> Self
Retains all compacted history in <session_dir>/archive/ with no retention cap.
Sourcepub const fn archive_with(config: ArchiveConfig) -> Self
pub const fn archive_with(config: ArchiveConfig) -> Self
Retains compacted history in <session_dir>/archive/ using custom ArchiveConfig.
Sourcepub const fn context_only() -> Self
pub const fn context_only() -> Self
Retains only the active context tail and compaction summary.
Sourcepub const fn archive_config(&self) -> Option<ArchiveConfig>
pub const fn archive_config(&self) -> Option<ArchiveConfig>
Returns archive settings when Self::Archive is active.
Trait Implementations§
Source§impl Clone for HistoryRetention
impl Clone for HistoryRetention
impl Copy for HistoryRetention
Source§impl Debug for HistoryRetention
impl Debug for HistoryRetention
Source§impl Default for HistoryRetention
impl Default for HistoryRetention
impl Eq for HistoryRetention
Source§impl PartialEq for HistoryRetention
impl PartialEq for HistoryRetention
impl StructuralPartialEq for HistoryRetention
Auto Trait Implementations§
impl Forget for HistoryRetention
impl Freeze for HistoryRetention
impl Move for HistoryRetention
impl RefUnwindSafe for HistoryRetention
impl Send for HistoryRetention
impl Sync for HistoryRetention
impl Unpin for HistoryRetention
impl UnsafeUnpin for HistoryRetention
impl UnwindSafe for HistoryRetention
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.