pub struct AuditLog {
pub path: PathBuf,
}std only.Expand description
Data structure representing audit log.
Fields§
§path: PathBufPath for this value.
Implementations§
Source§impl AuditLog
impl AuditLog
Sourcepub fn beside_state(state_path: &Path) -> Self
pub fn beside_state(state_path: &Path) -> Self
Performs beside state for this type.
Sourcepub fn append(&self, event: AuditEvent) -> Result<()>
pub fn append(&self, event: AuditEvent) -> Result<()>
Performs append for this type.
Sourcepub fn append_with_max_bytes(
&self,
event: AuditEvent,
max_bytes: u64,
) -> Result<()>
pub fn append_with_max_bytes( &self, event: AuditEvent, max_bytes: u64, ) -> Result<()>
Append an event with an explicit maximum audit-file size in bytes.
The check and append are serialized across cooperating local writers.
A zero limit rejects every record; use u64::MAX for an effectively
unlimited file. Existing bytes are never truncated or rotated.
Sourcepub fn append_with_privacy(
&self,
event: AuditEvent,
redact_user_content: bool,
) -> Result<()>
pub fn append_with_privacy( &self, event: AuditEvent, redact_user_content: bool, ) -> Result<()>
Append an event, optionally replacing user-provided text fields before serialization.
Sourcepub fn append_with_privacy_and_max_bytes(
&self,
event: AuditEvent,
redact_user_content: bool,
max_bytes: u64,
) -> Result<()>
pub fn append_with_privacy_and_max_bytes( &self, event: AuditEvent, redact_user_content: bool, max_bytes: u64, ) -> Result<()>
Append an event with privacy redaction and an explicit maximum file size.
Sourcepub fn read_all(&self) -> Result<Vec<AuditRecord>>
pub fn read_all(&self) -> Result<Vec<AuditRecord>>
Read and validate every complete JSONL record.
A malformed trailing line is an error here; use poll_after to retain
an incomplete trailing record while a writer is still appending.
Sourcepub fn byte_len(&self) -> Result<u64>
pub fn byte_len(&self) -> Result<u64>
Current file length in bytes (0 if missing). Use as the cursor for AuditLog::poll_after.
Sourcepub fn poll_after(&self, offset: u64) -> Result<(Vec<AuditRecord>, u64)>
pub fn poll_after(&self, offset: u64) -> Result<(Vec<AuditRecord>, u64)>
Read complete JSONL records written after offset bytes.
Returns (new_records, new_offset). Incomplete trailing lines are left
for a later poll (offset does not advance past them).
Sourcepub fn summarize(&self) -> Result<AuditSummary>
pub fn summarize(&self) -> Result<AuditSummary>
Performs summarize for this type.