Skip to content

Commit

Permalink
update: removed serde added strum for queuetype
Browse files Browse the repository at this point in the history
  • Loading branch information
heemankv committed Nov 7, 2024
1 parent ee8195b commit da11a0b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 22 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion crates/orchestrator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ starknet = { workspace = true }
starknet-core = "0.9.0"
starknet-os = { workspace = true }
starknet-settlement-client = { workspace = true }
strum_macros = "0.26.4"
strum = "0.26.0"
strum_macros = "0.26.0"
tempfile = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true, features = ["sync", "macros", "rt-multi-thread"] }
Expand Down
37 changes: 16 additions & 21 deletions crates/orchestrator/src/queue/job_queue.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::fmt;
use std::future::Future;
use std::str::FromStr;
use std::sync::Arc;
Expand All @@ -21,35 +20,37 @@ use crate::workers::proving::ProvingWorker;
use crate::workers::snos::SnosWorker;
use crate::workers::update_state::UpdateStateWorker;
use crate::workers::Worker;
use strum_macros::Display;

#[derive(Debug, Clone, Serialize, PartialEq, Eq)]
pub enum QueueType {
#[serde(rename = "snos_job_processing")]
#[derive(Display, Debug, Clone, PartialEq, Eq)]
enum QueueType {
#[strum(serialize = "snos_job_processing")]
SnosJobProcessing,
#[serde(rename = "snos_job_verification")]
#[strum(serialize = "snos_job_verification")]
SnosJobVerification,
#[serde(rename = "proving_job_processing")]
#[strum(serialize = "proving_job_processing")]
ProvingJobProcessing,
#[serde(rename = "proving_job_verification")]
#[strum(serialize = "proving_job_verification")]
ProvingJobVerification,
#[serde(rename = "proof_registration_job_processing")]
#[strum(serialize = "proof_registration_job_processing")]
ProofRegistrationJobProcessing,
#[serde(rename = "proof_registration_job_verification")]
#[strum(serialize = "proof_registration_job_verification")]
ProofRegistrationJobVerification,
#[serde(rename = "data_submission_job_processing")]
#[strum(serialize = "data_submission_job_processing")]
DataSubmissionJobProcessing,
#[serde(rename = "data_submission_job_verification")]
#[strum(serialize = "data_submission_job_verification")]
DataSubmissionJobVerification,
#[serde(rename = "update_state_job_processing")]
#[strum(serialize = "update_state_job_processing")]
UpdateStateJobProcessing,
#[serde(rename = "update_state_job_verification")]
#[strum(serialize = "update_state_job_verification")]
UpdateStateJobVerification,
#[serde(rename = "job_handle_failure")]
#[strum(serialize = "job_handle_failure")]
JobHandleFailure,
#[serde(rename = "worker_trigger")]
#[strum(serialize = "worker_trigger")]
WorkerTrigger,
}


impl QueueType {
pub fn iter() -> impl Iterator<Item = QueueType> {
[
Expand All @@ -71,12 +72,6 @@ impl QueueType {
}
}

impl fmt::Display for QueueType {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", serde_json::to_string(self).unwrap())
}
}

#[derive(Error, Debug, PartialEq)]
pub enum ConsumptionError {
#[error("Failed to consume message from queue, error {error_msg:?}")]
Expand Down

0 comments on commit da11a0b

Please sign in to comment.