solana_runtime::installed_scheduler_pool

Trait InstalledScheduler

source
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:

graph TD Bank["Arc#lt;Bank#gt;"] subgraph solana-runtime BankForks; BankWithScheduler; Bank; LoadExecuteAndCommitTransactions(["load_execute_and_commit_transactions()"]); SchedulingContext; InstalledSchedulerPool{{InstalledSchedulerPool}}; InstalledScheduler{{InstalledScheduler}}; end subgraph solana-unified-scheduler-pool SchedulerPool; PooledScheduler; ScheduleExecution(["schedule_execution()"]); end subgraph solana-ledger ExecuteBatch(["execute_batch()"]); end ScheduleExecution -. calls .-> ExecuteBatch; BankWithScheduler -. dyn-calls .-> ScheduleExecution; ExecuteBatch -. calls .-> LoadExecuteAndCommitTransactions; linkStyle 0,1,2 stroke:gray,color:gray; BankForks -- owns --> BankWithScheduler; BankForks -- owns --> InstalledSchedulerPool; BankWithScheduler -- refs --> Bank; BankWithScheduler -- owns --> InstalledScheduler; SchedulingContext -- refs --> Bank; InstalledScheduler -- owns --> SchedulingContext; SchedulerPool -- owns --> PooledScheduler; SchedulerPool -. impls .-> InstalledSchedulerPool; PooledScheduler -. impls .-> InstalledScheduler; PooledScheduler -- refs --> SchedulerPool;

Required Methods§

source

fn id(&self) -> SchedulerId

source

fn context(&self) -> &SchedulingContext

source

fn schedule_execution<'a>( &'a self, transaction_with_index: &'a (&'a SanitizedTransaction, usize), )

source

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.

source

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.

Implementors§