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§
sourcetype BlockNumber
type BlockNumber
Block number type.
sourcetype Error: TaskPoolError
type Error: TaskPoolError
Inner error type of queue storing algorithm.
sourcetype OutputError: From<Self::Error>
type OutputError: From<Self::Error>
Output error type of the queue.
Required Methods§
sourcefn add(bn: Self::BlockNumber, task: Self::Task) -> Result<(), Self::OutputError>
fn add(bn: Self::BlockNumber, task: Self::Task) -> Result<(), Self::OutputError>
Inserts given task in task pool.
sourcefn contains(bn: &Self::BlockNumber, task: &Self::Task) -> bool
fn contains(bn: &Self::BlockNumber, task: &Self::Task) -> bool
Returns bool, defining does task exist in task pool.
sourcefn delete(
bn: Self::BlockNumber,
task: Self::Task,
) -> Result<(), Self::OutputError>
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.