[][src]Trait transact::scheduler::Scheduler

pub trait Scheduler {
    fn set_result_callback(
        &mut self,
        callback: Box<dyn Fn(Option<BatchExecutionResult>) + Send>
    ) -> Result<(), SchedulerError>;
fn set_error_callback(
        &mut self,
        callback: Box<dyn Fn(SchedulerError) + Send>
    ) -> Result<(), SchedulerError>;
fn add_batch(&mut self, batch: BatchPair) -> Result<(), SchedulerError>;
fn cancel(&mut self) -> Result<Vec<BatchPair>, SchedulerError>;
fn finalize(&mut self) -> Result<(), SchedulerError>;
fn take_task_iterator(
        &mut self
    ) -> Result<Box<dyn Iterator<Item = ExecutionTask> + Send>, SchedulerError>;
fn new_notifier(
        &mut self
    ) -> Result<Box<dyn ExecutionTaskCompletionNotifier>, SchedulerError>; }

Schedules batches and transactions and returns execution results.

Required methods

fn set_result_callback(
    &mut self,
    callback: Box<dyn Fn(Option<BatchExecutionResult>) + Send>
) -> Result<(), SchedulerError>

Sets a callback to receive results from processing batches. The order the results are received is not guarenteed to be the same order as the batches were added with add_batch. If callback is called with None, all batch results have been sent (only used when the scheduler has been finalized and no more batches will be added).

fn set_error_callback(
    &mut self,
    callback: Box<dyn Fn(SchedulerError) + Send>
) -> Result<(), SchedulerError>

Sets a callback to receive any errors encountered by the Scheduler that are not related to a specific batch.

fn add_batch(&mut self, batch: BatchPair) -> Result<(), SchedulerError>

Adds a BatchPair to the scheduler.

fn cancel(&mut self) -> Result<Vec<BatchPair>, SchedulerError>

Drops any unscheduled transactions from this scheduler. Any already scheduled transactions will continue to execute.

Returns a Vec of the dropped BatchPairs.

fn finalize(&mut self) -> Result<(), SchedulerError>

Finalizes the scheduler, which will disable the ability to add more batches. After this is called, add_batch() will be return a FinalizedSchedulerError.

fn take_task_iterator(
    &mut self
) -> Result<Box<dyn Iterator<Item = ExecutionTask> + Send>, SchedulerError>

Returns an iterator that returns transactions to be executed.

fn new_notifier(
    &mut self
) -> Result<Box<dyn ExecutionTaskCompletionNotifier>, SchedulerError>

Returns a newly allocated ExecutionTaskCompletionNotifier which allows sending a notification to the scheduler that indicates the task has been executed.

Loading content...

Implementors

impl Scheduler for MultiScheduler[src]

impl Scheduler for SerialScheduler[src]

Loading content...