pub trait InstalledScheduler:
Send
+ Sync
+ Debug
+ 'static {
// Required methods
fn id(&self) -> SchedulerId;
fn context(&self) -> &SchedulingContext;
fn schedule_execution<'a>(
&'a self,
transaction_with_index: &'a (&'a SanitizedTransaction, usize),
);
fn wait_for_termination(
self: Box<Self>,
is_dropped: bool,
) -> (ResultWithTimings, UninstalledSchedulerBox);
fn pause_for_recent_blockhash(&mut self);
}
Expand description
Schedules, executes, and commits transactions under encapsulated implementation
The following chart illustrates the ownership/reference interaction between inter-dependent objects across crates:
Required Methods§
fn id(&self) -> SchedulerId
fn context(&self) -> &SchedulingContext
fn schedule_execution<'a>( &'a self, transaction_with_index: &'a (&'a SanitizedTransaction, usize), )
sourcefn wait_for_termination(
self: Box<Self>,
is_dropped: bool,
) -> (ResultWithTimings, UninstalledSchedulerBox)
fn wait_for_termination( self: Box<Self>, is_dropped: bool, ) -> (ResultWithTimings, UninstalledSchedulerBox)
Wait for a scheduler to terminate after processing.
This function blocks the current thread while waiting for the scheduler to complete all of
the executions for the scheduled transactions and to return the finalized
ResultWithTimings
. Along with the result, this function also makes the scheduler itself
uninstalled from the bank by transforming the consumed self.
If no transaction is scheduled, the result and timing will be Ok(())
and
ExecuteTimings::default()
respectively.
sourcefn pause_for_recent_blockhash(&mut self)
fn pause_for_recent_blockhash(&mut self)
Pause a scheduler after processing to update bank’s recent blockhash.
This function blocks the current thread like wait_for_termination(). However, the scheduler
won’t be consumed. This means the scheduler is responsible to retain the finalized
ResultWithTimings
internally until it’s wait_for_termination()
-ed to collect the result
later.