Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: data letter queue #73

Merged
merged 16 commits into from
Aug 13, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update: using strum for JobStatus Display
heemankv committed Aug 9, 2024
commit a9b18c6eb4af1ef2cced5fb99642f5a91bdbb3e0
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.

1 change: 1 addition & 0 deletions crates/orchestrator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -54,6 +54,7 @@ snos = { workspace = true }
starknet = { workspace = true }
starknet-core = "0.9.0"
starknet-settlement-client = { workspace = true }
strum_macros = "0.26.4"
thiserror = { workspace = true }
tokio = { workspace = true, features = ["sync", "macros", "rt-multi-thread"] }
tracing = { workspace = true }
29 changes: 13 additions & 16 deletions crates/orchestrator/src/jobs/types.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{collections::HashMap, fmt};
use std::collections::HashMap;

use color_eyre::eyre::eyre;
use color_eyre::Result;
@@ -83,40 +83,37 @@ pub enum JobType {
StateTransition,
}

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, PartialOrd)]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, PartialOrd, strum_macros::Display)]
pub enum JobStatus {
/// An acknowledgement that the job has been received by the
/// orchestrator and is waiting to be processed

#[strum(to_string = "Created")]
Created,
/// Some system has taken a lock over the job for processing and no
/// other system to process the job

#[strum(to_string = "Locked for Processing")]
LockedForProcessing,
/// The job has been processed and is pending verification

#[strum(to_string = "Pending Verification")]
PendingVerification,
/// The job has been processed and verified. No other actions needs to be taken

#[strum(to_string = "Completed")]
Completed,
/// The job was processed but the was unable to be verified under the given time
#[strum(to_string = "Verification Timeout")]
VerificationTimeout,
/// The job failed processing
#[strum(to_string = "Verification Failed")]
VerificationFailed,
/// The job failed completing
#[strum(to_string = "Failed")]
Failed,
}

impl fmt::Display for JobStatus {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
JobStatus::Created => write!(f, "Created"),
JobStatus::LockedForProcessing => write!(f, "Locked for Processing"),
JobStatus::PendingVerification => write!(f, "Pending Verification"),
JobStatus::Completed => write!(f, "Completed"),
JobStatus::VerificationTimeout => write!(f, "Verification Timeout"),
JobStatus::VerificationFailed => write!(f, "Verification Failed"),
JobStatus::Failed => write!(f, "Failed"),
}
}
}

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
pub struct JobItem {
/// an uuid to identify a job