pub trait NoteObserver {
// Required methods
fn name(&self) -> &'static str;
fn observe<'life0, 'life1, 'async_trait>(
&'life0 self,
note: &'life1 SyncedNote,
) -> Pin<Box<dyn Future<Output = Result<bool, ClientError>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: '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§
Sourcefn observe<'life0, 'life1, 'async_trait>(
&'life0 self,
note: &'life1 SyncedNote,
) -> Pin<Box<dyn Future<Output = Result<bool, ClientError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn observe<'life0, 'life1, 'async_trait>(
&'life0 self,
note: &'life1 SyncedNote,
) -> Pin<Box<dyn Future<Output = Result<bool, ClientError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Per-note hook. Runs before the screener verdict, so before the note’s id is recomputed and
its inclusion proof verified. note carries the note’s identity, metadata and inclusion
proof from the sync record, its resolved attachments (empty for a note without any) and, for
a fetched public note, its body.
Returns true to mark the enclosing block as relevant even if the screener discards it, so
sync persists its header.
Provided Methods§
Sourcefn 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,
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".