Skip to main content

AuditLogNotificationSink

Trait AuditLogNotificationSink 

Source
pub trait AuditLogNotificationSink: Send + Sync {
    // Required methods
    fn notification_logging_enabled(&self) -> bool;
    fn store_notifications(
        &mut self,
        notifications: &[BACnetAuditNotification],
        apdu_timeout_ms: u32,
    ) -> Result<(), Error>;

    // Provided methods
    fn store_notifications_with_change(
        &mut self,
        notifications: &[BACnetAuditNotification],
        apdu_timeout_ms: u32,
    ) -> Result<bool, Error> { ... }
    fn store_confirmed_notifications_with_change(
        &mut self,
        notifications: &[BACnetAuditNotification],
        apdu_timeout_ms: u32,
        receipt: CompletedAuditReceipt,
    ) -> Result<(ConfirmedAuditNotificationOutcome, bool), Error> { ... }
    fn has_completed_confirmed_receipt(
        &self,
        _key: &[u8],
        _now_unix_millis: u64,
    ) -> Result<bool, Error> { ... }
    fn store_confirmed_notifications(
        &mut self,
        notifications: &[BACnetAuditNotification],
        apdu_timeout_ms: u32,
        _receipt: CompletedAuditReceipt,
    ) -> Result<ConfirmedAuditNotificationOutcome, Error> { ... }
    fn stage_notification_batch(
        &mut self,
        notifications: &[BACnetAuditNotification],
        apdu_timeout_ms: u32,
        receipt: Option<CompletedAuditReceipt>,
    ) -> Result<AuditBatchStage, Error> { ... }
    fn finish_notification_batch(
        &mut self,
        staged: StagedAuditBatch,
    ) -> Result<(ConfirmedAuditNotificationOutcome, bool), Error> { ... }
}
Expand description

Mutable, object-owned receiver for one authorized Audit notification batch.

Implementations must commit the complete prospective state before exposing any in-memory change. The server uses this type-erased channel instead of downcasting an Audit Log object or taking ownership of its persistence.

Required Methods§

Source

fn notification_logging_enabled(&self) -> bool

Whether this sink currently accepts Audit notifications.

Source

fn store_notifications( &mut self, notifications: &[BACnetAuditNotification], apdu_timeout_ms: u32, ) -> Result<(), Error>

Merge or create every notification in wire order as one durable batch.

apdu_timeout_ms is the local Device object’s configured APDU_Timeout. It supplies the Clause 12.64 complementary timestamp window.

Provided Methods§

Source

fn store_notifications_with_change( &mut self, notifications: &[BACnetAuditNotification], apdu_timeout_ms: u32, ) -> Result<bool, Error>

Store a batch and report whether retained record content changed. Custom sinks must opt in to change reporting before they can forward.

Source

fn store_confirmed_notifications_with_change( &mut self, notifications: &[BACnetAuditNotification], apdu_timeout_ms: u32, receipt: CompletedAuditReceipt, ) -> Result<(ConfirmedAuditNotificationOutcome, bool), Error>

Store records and receipt atomically, reporting record changes separately from receipt-only commits. A duplicate must always report false.

Source

fn has_completed_confirmed_receipt( &self, _key: &[u8], _now_unix_millis: u64, ) -> Result<bool, Error>

Check the durable completed confirmed receipts without mutating them.

Source

fn store_confirmed_notifications( &mut self, notifications: &[BACnetAuditNotification], apdu_timeout_ms: u32, _receipt: CompletedAuditReceipt, ) -> Result<ConfirmedAuditNotificationOutcome, Error>

Atomically merge one confirmed batch and retain its completed receipt.

Source

fn stage_notification_batch( &mut self, notifications: &[BACnetAuditNotification], apdu_timeout_ms: u32, receipt: Option<CompletedAuditReceipt>, ) -> Result<AuditBatchStage, Error>

Stage a batch whose commit the caller awaits without the database guard (#1270): with receipt as store_confirmed_notifications_with_change stores it, without as store_notifications_with_change does. Nothing changes in memory until finish_notification_batch takes the committed batch.

The default stores the batch at once and returns AuditBatchStage::Done, so a sink that does not stage keeps its commit where it was.

Source

fn finish_notification_batch( &mut self, staged: StagedAuditBatch, ) -> Result<(ConfirmedAuditNotificationOutcome, bool), Error>

Take a batch stage_notification_batch staged, once its commit has run: the batch’s outcome and whether its retained records changed, or the commit’s error with memory unchanged.

The default fails with DEVICE / OPERATIONAL_PROBLEM, since the default stage never stages.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§