summaryrefslogtreecommitdiff
path: root/ofborg/tickborg/src/message/evaluationjob.rs
blob: bd51546e4aa4815c13c4b5a81defd3dd15f6eed8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use crate::message::{Pr, Repo};
use crate::worker;

pub fn from(data: &[u8]) -> Result<EvaluationJob, serde_json::error::Error> {
    serde_json::from_slice(data)
}

#[derive(serde::Serialize, serde::Deserialize, Debug)]
pub struct EvaluationJob {
    pub repo: Repo,
    pub pr: Pr,
}

pub struct Actions {}

impl Actions {
    pub fn retry_later(&mut self, _job: &EvaluationJob) -> worker::Actions {
        vec![worker::Action::NackRequeue]
    }

    pub fn skip(&mut self, _job: &EvaluationJob) -> worker::Actions {
        vec![worker::Action::Ack]
    }

    pub fn done(&mut self, _job: &EvaluationJob, mut response: worker::Actions) -> worker::Actions {
        response.push(worker::Action::Ack);
        response
    }
}