pub trait WalletMonitorTask: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn trigger(&mut self, now_msecs: u64) -> bool;
fn run_task<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<String, WalletError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn async_setup<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), WalletError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
A monitor task performs some periodic or state-triggered maintenance function on the data managed by a wallet.
The monitor maintains a collection of tasks. It runs each task’s non-async
trigger to determine if run_task needs to run. Tasks that need to be run
are executed consecutively by awaiting their async run_task method.
Tasks may use the monitor_events table to persist their execution history via the storage object.
Required Methods§
Provided Methods§
Sourcefn async_setup<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), WalletError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn async_setup<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), WalletError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Override to handle async task setup configuration.
Called before the first call to trigger.