1
0
mirror of https://github.com/containers/youki synced 2024-11-22 17:02:00 +01:00

Rust 1.80.0 (#2869)

Signed-off-by: utam0k <k0ma@utam0k.jp>
This commit is contained in:
Toru Komatsu 2024-08-13 08:50:14 +09:00 committed by GitHub
parent d85fdaf479
commit 1180637c41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 59 additions and 37 deletions

51
Cargo.lock generated

@ -3270,9 +3270,9 @@ dependencies = [
[[package]] [[package]]
name = "rustversion" name = "rustversion"
version = "1.0.15" version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80af6f9131f277a45a3fba6ce8e2258037bb0477a67e610d3c1fe046ab31de47" checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6"
[[package]] [[package]]
name = "ryu" name = "ryu"
@ -3967,9 +3967,9 @@ dependencies = [
[[package]] [[package]]
name = "time" name = "time"
version = "0.3.34" version = "0.3.36"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885"
dependencies = [ dependencies = [
"deranged", "deranged",
"itoa", "itoa",
@ -3979,7 +3979,7 @@ dependencies = [
"powerfmt", "powerfmt",
"serde", "serde",
"time-core", "time-core",
"time-macros 0.2.17", "time-macros 0.2.18",
] ]
[[package]] [[package]]
@ -4000,9 +4000,9 @@ dependencies = [
[[package]] [[package]]
name = "time-macros" name = "time-macros"
version = "0.2.17" version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf"
dependencies = [ dependencies = [
"num-conv", "num-conv",
"time-core", "time-core",
@ -4366,14 +4366,41 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]] [[package]]
name = "vergen" name = "vergen"
version = "8.3.2" version = "9.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2990d9ea5967266ea0ccf413a4aa5c42a93dbcfda9cb49a97de6931726b12566" checksum = "c32e7318e93a9ac53693b6caccfb05ff22e04a44c7cf8a279051f24c09da286f"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"cfg-if", "derive_builder 0.20.0",
"rustversion",
"time 0.3.36",
"vergen-lib",
]
[[package]]
name = "vergen-gitcl"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3bbdc9746577cb4767f218d320ee0b623d415e8130332f8f562b910b61cc2c4e"
dependencies = [
"anyhow",
"derive_builder 0.20.0",
"rustversion",
"time 0.3.36",
"vergen",
"vergen-lib",
]
[[package]]
name = "vergen-lib"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e06bee42361e43b60f363bad49d63798d0f42fb1768091812270eca00c784720"
dependencies = [
"anyhow",
"derive_builder 0.20.0",
"getset",
"rustversion", "rustversion",
"time 0.3.34",
] ]
[[package]] [[package]]
@ -5799,7 +5826,7 @@ dependencies = [
"tracing", "tracing",
"tracing-journald", "tracing-journald",
"tracing-subscriber", "tracing-subscriber",
"vergen", "vergen-gitcl",
"wasi-common", "wasi-common",
"wasmedge-sdk", "wasmedge-sdk",
"wasmer", "wasmer",

@ -183,7 +183,6 @@ pub struct PSIStats {
pub full: PSIData, pub full: PSIData,
} }
///
#[derive(Debug, Default, PartialEq, Serialize)] #[derive(Debug, Default, PartialEq, Serialize)]
pub struct PSIData { pub struct PSIData {
/// Running average over the last 10 seconds /// Running average over the last 10 seconds

@ -5,6 +5,7 @@ use super::serialize::Variant;
use super::utils::SystemdClientError; use super::utils::SystemdClientError;
pub trait SystemdClient { pub trait SystemdClient {
#[allow(dead_code)]
fn is_system(&self) -> bool; fn is_system(&self) -> bool;
fn transient_unit_exists(&self, unit_name: &str) -> bool; fn transient_unit_exists(&self, unit_name: &str) -> bool;

@ -23,6 +23,7 @@ const REPLY_BUF_SIZE: usize = 128; // seems good enough tradeoff between extra s
// For more information see https://www.freedesktop.org/wiki/Software/systemd/dbus/ // For more information see https://www.freedesktop.org/wiki/Software/systemd/dbus/
pub struct DbusConnection { pub struct DbusConnection {
/// Is the socket system level or session specific /// Is the socket system level or session specific
#[allow(dead_code)]
system: bool, system: bool,
/// socket fd /// socket fd
socket: i32, socket: i32,

@ -317,7 +317,7 @@ mod tests {
// check the limit file is set as expected // check the limit file is set as expected
let limit_content = read_to_string(tmp.path().join(CGROUP_MEMORY_MAX)).expect("read memory limit to string"); let limit_content = read_to_string(tmp.path().join(CGROUP_MEMORY_MAX)).expect("read memory limit to string");
let limit_check = match linux_memory.limit() { let limit_check = match linux_memory.limit() {
Some(limit) if limit == -1 => limit_content == "max", Some(-1) => limit_content == "max",
Some(limit) => limit_content == limit.to_string(), Some(limit) => limit_content == limit.to_string(),
None => limit_content == "0", None => limit_content == "0",
}; };
@ -325,7 +325,7 @@ mod tests {
// check the swap file is set as expected // check the swap file is set as expected
let swap_content = read_to_string(tmp.path().join(CGROUP_MEMORY_SWAP)).expect("read swap limit to string"); let swap_content = read_to_string(tmp.path().join(CGROUP_MEMORY_SWAP)).expect("read swap limit to string");
let swap_check = match linux_memory.swap() { let swap_check = match linux_memory.swap() {
Some(swap) if swap == -1 => swap_content == "max", Some(-1)=> swap_content == "max",
Some(swap) => { Some(swap) => {
if let Some(limit) = linux_memory.limit() { if let Some(limit) = linux_memory.limit() {
if limit == -1 { if limit == -1 {
@ -339,7 +339,7 @@ mod tests {
} }
None => { None => {
match linux_memory.limit() { match linux_memory.limit() {
Some(limit) if limit == -1 => swap_content == "max", Some(-1) => swap_content == "max",
_ => swap_content == "0", _ => swap_content == "0",
} }
} }
@ -349,7 +349,7 @@ mod tests {
// check the reservation file is set as expected // check the reservation file is set as expected
let reservation_content = read_to_string(tmp.path().join(CGROUP_MEMORY_LOW)).expect("read memory reservation to string"); let reservation_content = read_to_string(tmp.path().join(CGROUP_MEMORY_LOW)).expect("read memory reservation to string");
let reservation_check = match linux_memory.reservation() { let reservation_check = match linux_memory.reservation() {
Some(reservation) if reservation == -1 => reservation_content == "max", Some(-1) => reservation_content == "max",
Some(reservation) => reservation_content == reservation.to_string(), Some(reservation) => reservation_content == reservation.to_string(),
None => reservation_content == "0", None => reservation_content == "0",
}; };

@ -8,7 +8,7 @@ homepage = "https://containers.github.io/youki"
readme = "README.md" readme = "README.md"
authors = ["youki team"] authors = ["youki team"]
edition = "2021" edition = "2021"
rust-version = "1.58.1" rust-version = "1.63.0"
keywords = ["youki", "container", "cgroups"] keywords = ["youki", "container", "cgroups"]
[features] [features]

@ -11,10 +11,11 @@ use serde::{Deserialize, Serialize};
use tracing::instrument; use tracing::instrument;
/// Indicates status of the container /// Indicates status of the container
#[derive(Serialize, Deserialize, Debug, Copy, Clone, PartialEq, Eq)] #[derive(Serialize, Deserialize, Debug, Copy, Clone, PartialEq, Eq, Default)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub enum ContainerStatus { pub enum ContainerStatus {
// The container is being created // The container is being created
#[default]
Creating, Creating,
// The runtime has finished the create operation // The runtime has finished the create operation
Created, Created,
@ -26,12 +27,6 @@ pub enum ContainerStatus {
Paused, Paused,
} }
impl Default for ContainerStatus {
fn default() -> Self {
ContainerStatus::Creating
}
}
impl ContainerStatus { impl ContainerStatus {
pub fn can_start(&self) -> bool { pub fn can_start(&self) -> bool {
matches!(self, ContainerStatus::Created) matches!(self, ContainerStatus::Created)

@ -56,7 +56,7 @@ pub fn run_hooks(
tracing::debug!("run_hooks arg0: {:?}, args: {:?}", arg0, args); tracing::debug!("run_hooks arg0: {:?}, args: {:?}", arg0, args);
hook_command.arg0(arg0).args(args) hook_command.arg0(arg0).args(args)
} else { } else {
hook_command.arg0(&hook.path().display().to_string()) hook_command.arg0(hook.path().display().to_string())
}; };
let envs: HashMap<String, String> = if let Some(env) = hook.env() { let envs: HashMap<String, String> = if let Some(env) = hook.env() {

@ -181,9 +181,7 @@ mod test {
move || { move || {
// We clone the listener and listen on the cloned listener to // We clone the listener and listen on the cloned listener to
// make sure the cloned fd functions correctly. // make sure the cloned fd functions correctly.
let cloned_listener = listener.clone(); listener.wait_for_container_start().unwrap();
cloned_listener.wait_for_container_start().unwrap();
cloned_listener.close().unwrap();
} }
}); });

@ -56,6 +56,7 @@ type Result<T> = std::result::Result<T, MountError>;
pub struct MountOptions<'a> { pub struct MountOptions<'a> {
pub root: &'a Path, pub root: &'a Path,
pub label: Option<&'a str>, pub label: Option<&'a str>,
#[allow(dead_code)]
pub cgroup_ns: bool, pub cgroup_ns: bool,
} }

@ -57,4 +57,4 @@ scopeguard = "1.2.0"
[build-dependencies] [build-dependencies]
anyhow = "1.0.86" anyhow = "1.0.86"
vergen = { version = "8.3.2", features = ["git", "gitcl"] } vergen-gitcl = { version = "1.0.0", features = ["build"] }

@ -1,10 +1,9 @@
use anyhow::Result; use anyhow::Result;
use vergen::EmitBuilder; use vergen_gitcl::{Emitter, GitclBuilder};
fn main() -> Result<()> { pub fn main() -> Result<()> {
if EmitBuilder::builder() if Emitter::default()
.fail_on_error() .add_instructions(&GitclBuilder::all_git()?)?
.git_sha(true)
.emit() .emit()
.is_err() .is_err()
{ {

@ -49,6 +49,7 @@ pub struct ObservabilityConfig {
pub log_level: Option<String>, pub log_level: Option<String>,
pub log_file: Option<PathBuf>, pub log_file: Option<PathBuf>,
pub log_format: Option<String>, pub log_format: Option<String>,
#[allow(dead_code)]
pub systemd_log: bool, pub systemd_log: bool,
} }

@ -1,3 +1,3 @@
[toolchain] [toolchain]
profile="default" profile="default"
channel="1.77.2" channel="1.80.0"