pub struct AuditStore { /* private fields */ }Expand description
Append-only audit store backed by a JSON file.
In a future phase, this will be backed by LanceDB for vector search capabilities. For now, JSON file storage is sufficient and simple.
Implementations§
Source§impl AuditStore
impl AuditStore
Sourcepub fn new_memory() -> Self
pub fn new_memory() -> Self
Create an audit store using a temporary file (for tests).
Sourcepub fn log_action(&self, action: &Action, status: &str, output: &str)
pub fn log_action(&self, action: &Action, status: &str, output: &str)
Convenience: log an action with minimal params.
Sourcepub fn log(&self, params: AuditLogParams) -> Result<AuditEntry, AuditError>
pub fn log(&self, params: AuditLogParams) -> Result<AuditEntry, AuditError>
Append a new entry to the audit log.
Automatically computes the hash chain linkage from the last entry.
Sourcepub fn load_all(&self) -> Result<Vec<AuditEntry>, AuditError>
pub fn load_all(&self) -> Result<Vec<AuditEntry>, AuditError>
Load all audit entries from the log file.
Sourcepub fn query_by_workflow(
&self,
workflow_id: &str,
) -> Result<Vec<AuditEntry>, AuditError>
pub fn query_by_workflow( &self, workflow_id: &str, ) -> Result<Vec<AuditEntry>, AuditError>
Query entries by workflow ID.
Sourcepub fn query_by_time_range(
&self,
from: DateTime<Utc>,
to: DateTime<Utc>,
) -> Result<Vec<AuditEntry>, AuditError>
pub fn query_by_time_range( &self, from: DateTime<Utc>, to: DateTime<Utc>, ) -> Result<Vec<AuditEntry>, AuditError>
Query entries within a time range.
Sourcepub fn recent(&self, limit: usize) -> Result<Vec<AuditEntry>, AuditError>
pub fn recent(&self, limit: usize) -> Result<Vec<AuditEntry>, AuditError>
Get the most recent N entries.
Sourcepub fn verify_chain(&self) -> Result<bool, AuditError>
pub fn verify_chain(&self) -> Result<bool, AuditError>
Verify the integrity of the entire hash chain.
Returns Ok(true) if the chain is valid, or an error describing where the chain was broken.
Auto Trait Implementations§
impl !Freeze for AuditStore
impl RefUnwindSafe for AuditStore
impl Send for AuditStore
impl Sync for AuditStore
impl Unpin for AuditStore
impl UnsafeUnpin for AuditStore
impl UnwindSafe for AuditStore
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