You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
591 B
33 lines
591 B
4 years ago
|
//! A single running job
|
||
|
use super::*;
|
||
|
|
||
|
use tokio::{
|
||
|
sync::{
|
||
|
mpsc,
|
||
|
},
|
||
|
};
|
||
|
|
||
|
/// Commands to interrupt jobs
|
||
|
#[derive(Debug,PartialEq,Eq,Hash,Clone)]
|
||
|
pub enum Command
|
||
|
{
|
||
|
/// Start graceful shutdown, wait for children.
|
||
|
Stop,
|
||
|
/// Stop immediately
|
||
|
Abort,
|
||
|
/// Interrupt the current iteration, and restart the iterator if needed
|
||
|
Reseed(interval::Time),
|
||
|
/// Run the command now
|
||
|
Oneshot,
|
||
|
/// Config reload
|
||
|
Reload(context::Context),
|
||
|
/// Just restart the iterator
|
||
|
Restart,
|
||
|
}
|
||
|
|
||
|
#[derive(Debug)]
|
||
|
pub struct Job
|
||
|
{
|
||
|
handler: mpsc::Sender<Command>,
|
||
|
}
|