pub struct AuditEvent {
pub id: u64,
pub timestamp: SystemTime,
pub hlc: Option<HlcTimestamp>,
pub level: AuditLevel,
pub event_type: AuditEventType,
pub actor: String,
pub target: Option<String>,
pub description: String,
pub metadata: Vec<(String, String)>,
pub prev_checksum: Option<u64>,
pub checksum: u64,
}Expand description
A structured audit event.
Fields§
§id: u64Unique event ID.
timestamp: SystemTimeEvent timestamp (wall clock).
hlc: Option<HlcTimestamp>HLC timestamp for causal ordering.
level: AuditLevelEvent level.
event_type: AuditEventTypeEvent type.
actor: StringActor/component that generated the event.
target: Option<String>Target resource or kernel.
description: StringEvent description.
metadata: Vec<(String, String)>Additional metadata as key-value pairs.
prev_checksum: Option<u64>Previous event checksum (for tamper detection).
checksum: u64This event’s checksum.
Implementations§
Source§impl AuditEvent
impl AuditEvent
Sourcepub fn new(
level: AuditLevel,
event_type: AuditEventType,
actor: impl Into<String>,
description: impl Into<String>,
) -> Self
pub fn new( level: AuditLevel, event_type: AuditEventType, actor: impl Into<String>, description: impl Into<String>, ) -> Self
Create a new audit event.
Sourcepub fn with_hlc(self, hlc: HlcTimestamp) -> Self
pub fn with_hlc(self, hlc: HlcTimestamp) -> Self
Add an HLC timestamp.
Sourcepub fn with_target(self, target: impl Into<String>) -> Self
pub fn with_target(self, target: impl Into<String>) -> Self
Add a target resource.
Sourcepub fn with_metadata(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_metadata( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add metadata.
Sourcepub fn with_prev_checksum(self, checksum: u64) -> Self
pub fn with_prev_checksum(self, checksum: u64) -> Self
Set the previous checksum for chain integrity.
Sourcepub fn verify_checksum(&self) -> bool
pub fn verify_checksum(&self) -> bool
Verify the event checksum.
Sourcepub fn kernel_launched(
kernel_id: impl Into<String>,
backend: impl Into<String>,
) -> Self
pub fn kernel_launched( kernel_id: impl Into<String>, backend: impl Into<String>, ) -> Self
Create a kernel launched event.
Sourcepub fn kernel_terminated(
kernel_id: impl Into<String>,
reason: impl Into<String>,
) -> Self
pub fn kernel_terminated( kernel_id: impl Into<String>, reason: impl Into<String>, ) -> Self
Create a kernel terminated event.
Sourcepub fn security_violation(
actor: impl Into<String>,
violation: impl Into<String>,
) -> Self
pub fn security_violation( actor: impl Into<String>, violation: impl Into<String>, ) -> Self
Create a security violation event.
Sourcepub fn config_change(
actor: impl Into<String>,
config_key: impl Into<String>,
old_value: impl Into<String>,
new_value: impl Into<String>,
) -> Self
pub fn config_change( actor: impl Into<String>, config_key: impl Into<String>, old_value: impl Into<String>, new_value: impl Into<String>, ) -> Self
Create a configuration change event.
Trait Implementations§
Source§impl Clone for AuditEvent
impl Clone for AuditEvent
Source§fn clone(&self) -> AuditEvent
fn clone(&self) -> AuditEvent
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AuditEvent
impl RefUnwindSafe for AuditEvent
impl Send for AuditEvent
impl Sync for AuditEvent
impl Unpin for AuditEvent
impl UnwindSafe for AuditEvent
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.