Skip to main content

NoteObserver

Trait NoteObserver 

Source
pub trait NoteObserver {
    // Required methods
    fn name(&self) -> &'static str;
    fn observe<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        committed_note: &'life1 CommittedNote,
        attachments: Option<&'life2 NoteAttachments>,
    ) -> Pin<Box<dyn Future<Output = Result<bool, ClientError>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;

    // Provided method
    fn apply<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _sync_update: &'life1 StateSyncUpdate,
    ) -> Pin<Box<dyn Future<Output = Result<(), ClientError>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Per-note + post-sync side-channel into crate::sync::StateSync. Attach via StateSync::with_note_observer(...). Multiple observers run independently; errors are logged, never abort sync.

Required Methods§

Source

fn name(&self) -> &'static str

Identifier surfaced on tracing::warn! events for this observer.

Source

fn observe<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, committed_note: &'life1 CommittedNote, attachments: Option<&'life2 NoteAttachments>, ) -> Pin<Box<dyn Future<Output = Result<bool, ClientError>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Per-note hook. Runs before the screener verdict. attachments is the note’s resolved attachment content for this sync window (None if absent).

Returns true to mark the enclosing block as relevant even if the screener discards it, so sync persists its header.

Provided Methods§

Source

fn apply<'life0, 'life1, 'async_trait>( &'life0 self, _sync_update: &'life1 StateSyncUpdate, ) -> Pin<Box<dyn Future<Output = Result<(), ClientError>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Post-sync hook, invoked once after the sync window closes. Default impl is a no-op for observers that only need observe().

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§