Trait gear_common::scheduler::Scheduler

source ·
pub trait Scheduler {
    type BlockNumber;
    type Task;
    type Cost;
    type Error: TaskPoolError;
    type OutputError: From<Self::Error> + Debug;
    type CostsPerBlock: SchedulingCostsPerBlock<BlockNumber = Self::BlockNumber, Cost = Self::Cost>;
    type FirstIncompleteTasksBlock: ValueStorage<Value = Self::BlockNumber>;
    type TaskPool: TaskPool<BlockNumber = Self::BlockNumber, Task = Self::Task, Error = Self::Error, OutputError = Self::OutputError> + CountedByKey<Key = Self::BlockNumber, Length = usize> + KeyIterableByKeyMap<Key1 = Self::BlockNumber, Key2 = Self::Task>;

    // Provided method
    fn reset() { ... }
}
Expand description

Represents scheduler’s logic of centralized delayed tasks management logic.

Required Associated Types§

source

type BlockNumber

Block number type of the messenger.

source

type Task

Task type.

source

type Cost

Cost type.

source

type Error: TaskPoolError

Inner error type generated by gear’s storage types.

source

type OutputError: From<Self::Error> + Debug

Output error of each storage algorithm.

Implements From<Self::Error> to be able to return any required error type.

source

type CostsPerBlock: SchedulingCostsPerBlock<BlockNumber = Self::BlockNumber, Cost = Self::Cost>

Storing costs per block.

source

type FirstIncompleteTasksBlock: ValueStorage<Value = Self::BlockNumber>

The first block of incomplete tasks, which have already passed, but still contain tasks to deal with.

Used for checking if scheduler is able to process current block aimed tasks, or there are some incomplete job from previous blocks.

source

type TaskPool: TaskPool<BlockNumber = Self::BlockNumber, Task = Self::Task, Error = Self::Error, OutputError = Self::OutputError> + CountedByKey<Key = Self::BlockNumber, Length = usize> + KeyIterableByKeyMap<Key1 = Self::BlockNumber, Key2 = Self::Task>

Gear task pool.

Task pool contains tasks with block number when they should be done.

Provided Methods§

source

fn reset()

Resets all related to messenger storages.

It’s a temporary production solution to avoid DB migrations and would be available for test purposes only in the future.

Object Safety§

This trait is not object safe.

Implementors§