Skip to main content

AppDataChangeCallback

Trait AppDataChangeCallback 

Source
pub trait AppDataChangeCallback: MaybeSend + MaybeSync {
    // Required method
    fn on_app_data_changed<'life0, 'async_trait>(
        &'life0 self,
        change: AppDataChange,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Notified whenever a processed message changed a group’s app_data.

Async so an implementation can do the read-modify-write of a semantic merge — including publishing the merged result — before returning.

Two requirements on an implementation, both from the module’s timeout rules:

  • Do not block the calling thread. Await instead. A handler that blocks cannot be timed out, and stalls the group’s sync for as long as it runs.
  • Publish with the compare-and-swap guard if it publishes at all — update_app_data(merged, Some(change.new_value)). A handler abandoned at the budget may still be running, and the guard is what stops its late write from overwriting a newer one.

Required Methods§

Source

fn on_app_data_changed<'life0, 'async_trait>( &'life0 self, change: AppDataChange, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§