use std::fmt;
use super::JobId;
use crate::time::ExactDuration;
#[derive(Clone, Debug, PartialEq, Eq)]
#[non_exhaustive]
pub struct JobInfo {
pub id: JobId,
pub name: String,
pub connection: String,
pub queue: String,
pub attempt: u32,
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct JobProcessed {
pub job: JobInfo,
pub outcome: JobOutcome,
pub duration: ExactDuration,
}
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct JobFailed {
pub job: JobInfo,
pub error: crate::Error,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[non_exhaustive]
pub enum JobOutcome {
Succeeded,
Released,
Deleted,
Debounced,
MissingModels,
Retrying,
Failed,
}
impl fmt::Display for JobOutcome {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(match self {
Self::Succeeded => "succeeded",
Self::Released => "released",
Self::Deleted => "deleted",
Self::Debounced => "debounced",
Self::MissingModels => "missing models",
Self::Retrying => "retrying",
Self::Failed => "failed",
})
}
}