pub struct KnowledgePartition {
pub entries: Vec<KnowledgeEntry>,
pub token_count: u32,
}Expand description
The knowledge partition: durable, identity-bearing entries rendered into system[1].
Appends are immediate (they extend the cached prefix — the cheap direction); mutation and
removal of existing entries are boundary-deferred (see KnowledgeEntry::evict_at_boundary).
Fields§
§entries: Vec<KnowledgeEntry>§token_count: u32Implementations§
Source§impl KnowledgePartition
impl KnowledgePartition
pub fn new() -> Self
Sourcepub fn push(&mut self, msg: Message, token_count: u32)
pub fn push(&mut self, msg: Message, token_count: u32)
Unkeyed immediate append — exactly push_entry(None, msg, tokens, false).
Sourcepub fn push_entry(
&mut self,
key: Option<CompactString>,
msg: Message,
tokens: u32,
pinned: bool,
)
pub fn push_entry( &mut self, key: Option<CompactString>, msg: Message, tokens: u32, pinned: bool, )
Keyed push: a fresh key (or None) appends immediately; an existing key stages a
boundary-deferred upsert (and clears any pending eviction — the entry is wanted again).
pinned takes effect immediately in both cases (it is bookkeeping, not rendered bytes).
Sourcepub fn remove(&mut self, key: &str) -> bool
pub fn remove(&mut self, key: &str) -> bool
Mark the keyed entry for removal at the next boundary. Errs-open: unknown key is a no-op. Returns whether a matching entry was marked.
Sourcepub fn sweep_at_boundary(&mut self) -> KnowledgeSweep
pub fn sweep_at_boundary(&mut self) -> KnowledgeSweep
Apply pending upserts and drop marked entries. Call ONLY at compaction/renewal boundaries — this is the one place existing system[1] bytes may be rewritten.
Sourcepub fn messages(&self) -> impl Iterator<Item = &Message>
pub fn messages(&self) -> impl Iterator<Item = &Message>
The rendered messages, in entry order (renderer / snapshot surface).
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Clone for KnowledgePartition
impl Clone for KnowledgePartition
Source§fn clone(&self) -> KnowledgePartition
fn clone(&self) -> KnowledgePartition
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more