diff --git a/Cargo.lock b/Cargo.lock index 21373bd..a03ea60 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -211,31 +211,6 @@ dependencies = [ "piper", ] -[[package]] -name = "bon" -version = "3.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebeb9aaf9329dff6ceb65c689ca3db33dbf15f324909c60e4e5eef5701ce31b1" -dependencies = [ - "bon-macros", - "rustversion", -] - -[[package]] -name = "bon-macros" -version = "3.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77e9d642a7e3a318e37c2c9427b5a6a48aa1ad55dcd986f3034ab2239045a645" -dependencies = [ - "darling", - "ident_case", - "prettyplease", - "proc-macro2", - "quote", - "rustversion", - "syn 2.0.111", -] - [[package]] name = "borsh" version = "1.6.0" @@ -346,41 +321,6 @@ version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" -[[package]] -name = "darling" -version = "0.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1247195ecd7e3c85f83c8d2a366e4210d588e802133e1e355180a9870b517ea4" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn 2.0.111", -] - -[[package]] -name = "darling_macro" -version = "0.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" -dependencies = [ - "darling_core", - "quote", - "syn 2.0.111", -] - [[package]] name = "dyn-clone" version = "1.0.20" @@ -457,12 +397,6 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - [[package]] name = "funty" version = "2.0.0" @@ -544,12 +478,6 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - [[package]] name = "indexmap" version = "2.12.1" @@ -581,12 +509,9 @@ name = "judge-runner" version = "0.1.0" dependencies = [ "anyhow", - "bon", "byte-unit", "cgroups-rs", - "nix 0.30.1", "uuid", - "wait-timeout", ] [[package]] @@ -718,16 +643,6 @@ dependencies = [ "zerocopy", ] -[[package]] -name = "prettyplease" -version = "0.2.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" -dependencies = [ - "proc-macro2", - "syn 2.0.111", -] - [[package]] name = "proc-macro-crate" version = "3.4.0" @@ -1044,12 +959,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - [[package]] name = "syn" version = "1.0.109" @@ -1229,15 +1138,6 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" -[[package]] -name = "wait-timeout" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11" -dependencies = [ - "libc", -] - [[package]] name = "wasi" version = "0.11.1+wasi-snapshot-preview1" diff --git a/Cargo.toml b/Cargo.toml index e530411..7870cf0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,9 +12,6 @@ A code runner library for online judge system [dependencies] anyhow = "1.0.100" -bon = "3.8.1" byte-unit = "5.2.0" cgroups-rs = "0.5.0" -nix = { version = "0.30.1", default-features = false, features = ["signal"] } uuid = { version = "1.19.0", features = ["v4", "fast-rng"] } -wait-timeout = "0.2.1" diff --git a/src/sandbox/resource.rs b/src/sandbox/resource.rs index ee3c5e4..2543e86 100644 --- a/src/sandbox/resource.rs +++ b/src/sandbox/resource.rs @@ -1,27 +1,25 @@ use std::time::Duration; -use bon::Builder; use byte_unit::Byte; use cgroups_rs::fs::{Cgroup, cgroup_builder::CgroupBuilder, hierarchies}; use uuid::Uuid; const PREFIX: &str = "judge"; -#[derive(Clone, Copy, Builder)] +#[derive(Clone, Copy)] pub struct Resource { - #[builder(default = Byte::GIGABYTE)] pub memory: Byte, - - #[builder(default = Duration::from_millis(100))] pub cpu_quota: Duration, - - #[builder(default = Duration::from_millis(100))] pub cpu_period: Duration, } impl Default for Resource { fn default() -> Self { - Resource::builder().build() + Resource { + memory: Byte::GIGABYTE, + cpu_quota: Duration::from_millis(100), + cpu_period: Duration::from_millis(100), + } } }