Skip to content

Commit

Permalink
fix(Judger): ✨ add trigger for filesystem mount
Browse files Browse the repository at this point in the history
  • Loading branch information
Eason0729 committed May 8, 2024
1 parent 0a2c15b commit eb959c6
Show file tree
Hide file tree
Showing 13 changed files with 466 additions and 115 deletions.
48 changes: 46 additions & 2 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 judger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ crossbeam = "0.8.4"
lazy_static = "1.4.0"
libc = "0.2.154"
bytes = "1.6.0"
test-log = "0.2.16"

[dependencies.fuse3]
version = "0.7.1"
Expand Down
32 changes: 27 additions & 5 deletions judger/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,49 @@ pub enum Accounting {
Cpu,
}

fn default_ratio_cpu() -> f32 {
1.0
}
fn default_ratio_memory() -> f32 {
1.0
}

#[derive(Serialize, Deserialize, Default)]
pub struct Machine {
cpu: Option<f32>,
memory: Option<f32>,
pub struct Ratio {
#[serde(default = "default_ratio_cpu")]
pub cpu: f32,
#[serde(default = "default_ratio_memory")]
pub memory: f32,
}

fn default_log() -> u8 {
1
}

fn default_ratio() -> Ratio {
Ratio {
cpu: 1.0,
memory: 1024.0,
}
}

fn default_memory() -> u64 {
1024 * 1024 * 1024
}

#[derive(Serialize, Deserialize, Default)]
#[serde(deny_unknown_fields)]
pub struct Config {
#[serde(default)]
pub accounting: Accounting,
#[serde(default)]
pub machine: Machine,
#[serde(default = "default_ratio")]
pub ratio: Ratio,
#[serde(default)]
pub rootless: bool,
#[serde(default = "default_log")]
pub log: u8,
#[serde(default)]
pub secret: Option<String>,
#[serde(default = "default_memory")]
pub memory: u64,
}
Loading

0 comments on commit eb959c6

Please sign in to comment.