Trait polkadot_node_subsystem_util::JobTrait[][src]

pub trait JobTrait: Unpin + Sized {
    type ToJob: 'static + BoundToRelayParent + Send;
    type Error: 'static + Error + Send;
    type RunArgs: 'static + Send;
    type Metrics: 'static + Metrics + Send;

    const NAME: &'static str;

    fn run<S: SubsystemSender>(
        parent: Hash,
        span: Arc<Span>,
        run_args: Self::RunArgs,
        metrics: Self::Metrics,
        receiver: Receiver<Self::ToJob>,
        sender: JobSender<S>
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send>>; }
Expand description

This trait governs jobs.

Jobs are instantiated and killed automatically on appropriate overseer messages. Other messages are passed along to and from the job via the overseer to other subsystems.

Associated Types

Message type used to send messages to the job.

Job runtime error.

Extra arguments this job needs to run properly.

If no extra information is needed, it is perfectly acceptable to set it to ().

Subsystem-specific Prometheus metrics.

Jobs spawned by one subsystem should share the same instance of metrics (use .clone()). The delegate_subsystem! macro should take care of this.

Associated Constants

Name of the job, i.e. candidate-backing-job

Required methods

Run a job for the given relay parent.

The job should be ended when receiver returns None.

Implementors