pub struct EventLog { /* private fields */ }Expand description
A newline-delimited event log. It deliberately records normalized events rather than UI operations, so sessions can be replayed by a future renderer or adapter host. Each append closes its file handle but does not force a storage sync; the terminal input/render loop must never block on fsync.
Implementations§
Source§impl EventLog
impl EventLog
pub fn open(path: impl Into<PathBuf>) -> Self
pub fn path(&self) -> &Path
pub fn append(&self, event: &AgentEvent) -> Result<()>
Sourcepub fn append_durable(&self, event: &AgentEvent) -> Result<()>
pub fn append_durable(&self, event: &AgentEvent) -> Result<()>
Append an event and force it to stable storage.
The regular append path is deliberately lightweight
because it is called from the terminal event loop. Call this only at a
durability boundary such as a completed turn or explicit shutdown.
Sourcepub fn sync(&self) -> Result<()>
pub fn sync(&self) -> Result<()>
Force already-appended records to stable storage without writing a duplicate event. This is useful for callers that batch lightweight appends and checkpoint at turn boundaries.
Sourcepub fn buffered(&self) -> Result<BufferedEventLog>
pub fn buffered(&self) -> Result<BufferedEventLog>
Start a background writer for event-loop use. The returned handle
queues records in memory and performs all file I/O on its worker
thread. Use BufferedEventLog::flush at explicit durability
boundaries such as completed turns.