pub struct LogStore { /* private fields */ }Implementations§
Source§impl LogStore
impl LogStore
pub fn new() -> Self
pub async fn create_session_log(&self, session_id: &str)
pub async fn append(&self, session_id: &str, entry: LogEntry)
pub async fn get_log(&self, session_id: &str) -> Option<Vec<LogEntry>>
Sourcepub async fn get_incoming_after(
&self,
session_id: &str,
after_sequence: u64,
) -> Result<Vec<(u64, LogEntry)>, u64>
pub async fn get_incoming_after( &self, session_id: &str, after_sequence: u64, ) -> Result<Vec<(u64, LogEntry)>, u64>
Returns accepted (Incoming) log entries strictly after after_sequence,
paired with their 1-based accepted-envelope ordinal.
Sequence contract (RFC-MACP-0006 §3.2): the per-session sequence is the
ordinal of accepted session envelopes — the first accepted envelope
(SessionStart) is 1. after_sequence is EXCLUSIVE: 0 replays from
the start, n resumes after the n-th accepted envelope. Internal and
Checkpoint entries never consume ordinals, so client-visible sequences
are contiguous and stable regardless of interleaved internal records.
(The previous implementation compared against the raw combined log
index inclusively — non-contiguous, shifting with internal entries,
and off by one against the RFC’s after_sequence + 1 replay rule.)
Sourcepub async fn remove_session_log(&self, session_id: &str)
pub async fn remove_session_log(&self, session_id: &str)
Drop a session’s in-memory log (eviction). The durable log remains in storage; a later restart replays it if needed.
Sourcepub async fn replace_session_log(
&self,
session_id: &str,
entries: Vec<LogEntry>,
)
pub async fn replace_session_log( &self, session_id: &str, entries: Vec<LogEntry>, )
Replace a session’s in-memory log wholesale — used by compaction so memory and storage stay in step (previously only disk was rewritten, leaving divergent in-memory history until restart).