pub struct AuditStore<B: StorageBackend + ?Sized> { /* private fields */ }Expand description
Audit store for compliance logging
§Multi-Tenancy
Chain state (hash and sequence) is now stored per-tenant in the backend, ensuring tenant isolation and preventing cross-tenant chain corruption.
Implementations§
Source§impl<B: StorageBackend + ?Sized> AuditStore<B>
impl<B: StorageBackend + ?Sized> AuditStore<B>
Sourcepub async fn log(
&self,
tenant_id: &str,
event_type: AuditEventType,
actor: ActorType,
agent_id: Option<Uuid>,
data: Value,
) -> Result<AuditEvent, StorageError>
pub async fn log( &self, tenant_id: &str, event_type: AuditEventType, actor: ActorType, agent_id: Option<Uuid>, data: Value, ) -> Result<AuditEvent, StorageError>
Log an audit event (automatically chained with sequence number)
Chain state is stored per-tenant to ensure proper isolation.
Sourcepub async fn get(
&self,
tenant_id: &str,
id: Uuid,
) -> Result<Option<AuditEvent>, StorageError>
pub async fn get( &self, tenant_id: &str, id: Uuid, ) -> Result<Option<AuditEvent>, StorageError>
Get event by ID
Sourcepub async fn get_chain(
&self,
tenant_id: &str,
) -> Result<Vec<AuditEvent>, StorageError>
pub async fn get_chain( &self, tenant_id: &str, ) -> Result<Vec<AuditEvent>, StorageError>
Get all events in chain order
Sourcepub async fn build_merkle_tree(
&self,
tenant_id: &str,
) -> Result<MerkleTree, StorageError>
pub async fn build_merkle_tree( &self, tenant_id: &str, ) -> Result<MerkleTree, StorageError>
Build Merkle tree of all events for a tenant
Sourcepub async fn verify_chain(&self, tenant_id: &str) -> Result<bool, StorageError>
pub async fn verify_chain(&self, tenant_id: &str) -> Result<bool, StorageError>
Verify chain integrity for a tenant
Sourcepub async fn export(&self, tenant_id: &str) -> Result<AuditExport, StorageError>
pub async fn export(&self, tenant_id: &str) -> Result<AuditExport, StorageError>
Export audit trail for compliance for a tenant
Trait Implementations§
Auto Trait Implementations§
impl<B> Freeze for AuditStore<B>where
B: ?Sized,
impl<B> RefUnwindSafe for AuditStore<B>where
B: RefUnwindSafe + ?Sized,
impl<B> Send for AuditStore<B>where
B: ?Sized,
impl<B> Sync for AuditStore<B>where
B: ?Sized,
impl<B> Unpin for AuditStore<B>where
B: ?Sized,
impl<B> UnwindSafe for AuditStore<B>where
B: RefUnwindSafe + ?Sized,
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more