diff --git a/ofborg/src/bin/builder.rs b/ofborg/src/bin/builder.rs index c74a06d..d8cd613 100644 --- a/ofborg/src/bin/builder.rs +++ b/ofborg/src/bin/builder.rs @@ -69,9 +69,16 @@ struct BuildWorker { system: String, } +impl BuildWorker { + fn actions(&self) -> buildjob::Actions { + return buildjob::Actions{ + system: self.system.clone(), + }; + } +} + impl worker::SimpleWorker for BuildWorker { type J = buildjob::BuildJob; - type R = buildjob::Actions; fn msg_to_job(&self, method: &Deliver, headers: &BasicProperties, body: &Vec) -> Result { @@ -85,14 +92,7 @@ impl worker::SimpleWorker for BuildWorker { } } - fn job_to_actions(&self) -> buildjob::Actions { - return buildjob::Actions{ - system: self.system.clone(), - }; - } - - - fn consumer(&self, job: &buildjob::BuildJob, resp: buildjob::Actions) -> Result<(), Error> { + fn consumer(&self, job: &buildjob::BuildJob) -> Result<(), Error> { let project = self.cloner.project(job.repo.full_name.clone(), job.repo.clone_url.clone()); let co = project.clone_for("builder".to_string(), job.pr.number.to_string())?; diff --git a/ofborg/src/worker.rs b/ofborg/src/worker.rs index 6efc0bd..1a7438f 100644 --- a/ofborg/src/worker.rs +++ b/ofborg/src/worker.rs @@ -17,13 +17,11 @@ enum Action { pub trait SimpleWorker { type J; - type R; - fn consumer(&self, job: &Self::J, resp: Self::R) -> Result<(), Error>; + + fn consumer(&self, job: &Self::J) -> Result<(), Error>; fn msg_to_job(&self, method: &Deliver, headers: &BasicProperties, body: &Vec) -> Result; - - fn job_to_actions(&self) -> Self::R; } pub fn new(worker: T) -> Worker { @@ -42,7 +40,6 @@ impl Consumer for Worker { body: Vec) { let job = self.internal.msg_to_job(&method, &headers, &body).unwrap(); - let actions = self.internal.job_to_actions(); - self.internal.consumer(&job, actions).unwrap(); + self.internal.consumer(&job).unwrap(); } }