Trait gear_common::scheduler::TaskPool

source ·
pub trait TaskPool {
    type BlockNumber;
    type Task;
    type Error: TaskPoolError;
    type OutputError: From<Self::Error>;

    // Required methods
    fn add(
        bn: Self::BlockNumber,
        task: Self::Task,
    ) -> Result<(), Self::OutputError>;
    fn clear();
    fn contains(bn: &Self::BlockNumber, task: &Self::Task) -> bool;
    fn delete(
        bn: Self::BlockNumber,
        task: Self::Task,
    ) -> Result<(), Self::OutputError>;
}
Expand description

Represents tasks managing logic.

Required Associated Types§

source

type BlockNumber

Block number type.

source

type Task

Task type.

source

type Error: TaskPoolError

Inner error type of queue storing algorithm.

source

type OutputError: From<Self::Error>

Output error type of the queue.

Required Methods§

source

fn add(bn: Self::BlockNumber, task: Self::Task) -> Result<(), Self::OutputError>

Inserts given task in task pool.

source

fn clear()

Removes all tasks from task pool.

source

fn contains(bn: &Self::BlockNumber, task: &Self::Task) -> bool

Returns bool, defining does task exist in task pool.

source

fn delete( bn: Self::BlockNumber, task: Self::Task, ) -> Result<(), Self::OutputError>

Removes task from task pool by given keys, if present, else returns error.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T, Task, Error, OutputError, Callbacks> TaskPool for TaskPoolImpl<T, Task, Error, OutputError, Callbacks>
where T: DoubleMapStorage<Key2 = Task, Value = ()>, Error: TaskPoolError, OutputError: From<Error>, Callbacks: TaskPoolCallbacks,

§

type BlockNumber = <T as DoubleMapStorage>::Key1

§

type Task = <T as DoubleMapStorage>::Key2

§

type Error = Error

§

type OutputError = OutputError