From a36d5ff276c2cc90cd224f2b143708e1f9578602 Mon Sep 17 00:00:00 2001 From: sisungo Date: Thu, 2 May 2024 15:30:54 +0800 Subject: [PATCH] release: airup v0.10.0 --- CHANGELOG | 12 ++++++++++ SECURITY.md | 2 +- airup-sdk/Cargo.toml | 2 +- airup/Cargo.toml | 2 +- airup/src/reboot.rs | 46 +++++++----------------------------- airupd/Cargo.toml | 2 +- airupd/src/extension.rs | 4 ++-- airupd/src/milestones/mod.rs | 1 + airupd/src/supervisor/mod.rs | 14 +++++------ 9 files changed, 34 insertions(+), 51 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 5496f60..428c616 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,15 @@ +Changes in v0.10.0: + * feature: separate log extensions and `fallback-logger` from `airupd` to independent processes + * feature: an extension system based on RPC + * BREAKING: feature: `log_dir` is removed from `build_manifest.json` + * fix: cannot correctly perform userspace reboot because `AIRUP_MILESTONE` is set to `userspace-reboot` and a loop happens + * BREAKING: feature: logger apis under `system.*` are no longer available + * BREAKING: cli: `airup reboot`'s usage is refactored + * BREAKING: rpc protocol: the serialization is migrated from JSON to CBOR + * fix: cgroup name is misunderstanding + * feature: memory statistics when using realms + * note: `airup-eventsourced` is removed and its functionability about to be moved to another repository + Changes in v0.9.4: * feature: logging in `airup-eventsourced`'s timers * compatibility: add FreeBSD support diff --git a/SECURITY.md b/SECURITY.md index 663be25..687904b 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -2,7 +2,7 @@ ## Supported Versions The `HEAD` and the latest release are supported by the Airup developers. The maintained versions are: - - Mainline: `0.10.0-rc.5` + - Mainline: `0.10.0` - Stable: `0.9.4` ## Reporting a Vulnerability diff --git a/airup-sdk/Cargo.toml b/airup-sdk/Cargo.toml index bca2321..7289983 100644 --- a/airup-sdk/Cargo.toml +++ b/airup-sdk/Cargo.toml @@ -4,7 +4,7 @@ authors = ["sisungo "] description = "SDK library of Airup" documentation = "https://docs.rs/airup-sdk" repository = "https://github.com/sisungo/airup" -version = "0.10.0-rc.5" +version = "0.10.0" edition = "2021" license = "MIT" diff --git a/airup/Cargo.toml b/airup/Cargo.toml index 9f64131..11a5b34 100644 --- a/airup/Cargo.toml +++ b/airup/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "airup" authors = ["sisungo "] -version = "0.10.0-rc.5" +version = "0.10.0" edition = "2021" license = "MIT" publish = false diff --git a/airup/src/reboot.rs b/airup/src/reboot.rs index b26ee6d..dbcb178 100644 --- a/airup/src/reboot.rs +++ b/airup/src/reboot.rs @@ -5,49 +5,19 @@ use clap::Parser; #[derive(Debug, Clone, Parser)] #[command(about)] pub struct Cmdline { - /// Halt the device - #[arg( - long, - conflicts_with = "poweroff", - conflicts_with = "reboot", - conflicts_with = "userspace" - )] - halt: bool, - - /// Power off the device - #[arg( - long, - conflicts_with = "halt", - conflicts_with = "reboot", - conflicts_with = "userspace" - )] - poweroff: bool, - - /// Reboot the device - #[arg(long, conflicts_with = "halt", conflicts_with = "poweroff")] - reboot: bool, - - /// Perform a userspace reboot - #[arg(long, conflicts_with = "halt", conflicts_with = "poweroff")] - userspace: bool, + /// Specify the reboot mode + #[arg(default_value = "reboot")] + mode: String, } -/// Entrypoint of the `airup reboot` subprogram. -pub fn main(cmdline: Cmdline) -> anyhow::Result<()> { +pub fn main(mut cmdline: Cmdline) -> anyhow::Result<()> { let mut conn = super::connect()?; - if cmdline.reboot { - conn.enter_milestone("reboot")?.ok(); - } - if cmdline.poweroff { - conn.enter_milestone("poweroff")?.ok(); - } - if cmdline.halt { - conn.enter_milestone("halt")?.ok(); - } - if cmdline.userspace { - conn.enter_milestone("userspace-reboot")?.ok(); + if cmdline.mode == "userspace" { + cmdline.mode = "userspace-reboot".into(); } + conn.enter_milestone(&cmdline.mode)?.ok(); + Ok(()) } diff --git a/airupd/Cargo.toml b/airupd/Cargo.toml index 834587e..8aa1f1b 100644 --- a/airupd/Cargo.toml +++ b/airupd/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "airupd" authors = ["sisungo "] -version = "0.10.0-rc.5" +version = "0.10.0" edition = "2021" license = "MIT" publish = false diff --git a/airupd/src/extension.rs b/airupd/src/extension.rs index 406fcb3..6f9079f 100644 --- a/airupd/src/extension.rs +++ b/airupd/src/extension.rs @@ -118,7 +118,7 @@ impl ExtensionHost { // accepting requests let mut acceptor = { - let reqs = reqs.clone(); + let reqs = Arc::clone(&reqs); tokio::spawn(async move { let mut req_id = 1; while let Some((mut req, sender)) = self.gate.recv().await { @@ -137,7 +137,7 @@ impl ExtensionHost { // handling responses let mut handler = { - let reqs = reqs.clone(); + let reqs = Arc::clone(&reqs); tokio::spawn(async move { loop { let Ok(buf) = rx.recv().await else { diff --git a/airupd/src/milestones/mod.rs b/airupd/src/milestones/mod.rs index 1c350fe..f349c58 100644 --- a/airupd/src/milestones/mod.rs +++ b/airupd/src/milestones/mod.rs @@ -36,6 +36,7 @@ impl Manager { Self::default() } + /// Returns a stack structure that contains all milestones which were entered in the system. pub fn stack(&self) -> Vec { self.stack.read().unwrap().clone() } diff --git a/airupd/src/supervisor/mod.rs b/airupd/src/supervisor/mod.rs index b631c6e..c97ada0 100644 --- a/airupd/src/supervisor/mod.rs +++ b/airupd/src/supervisor/mod.rs @@ -56,11 +56,11 @@ impl Manager { let provided = service.service.provides.clone(); let handle = SupervisorHandle::new(service); - lock.insert(name, handle.clone()); + lock.insert(name, Arc::clone(&handle)); let mut lock = self.provided.write().await; for i in provided { - lock.insert(i, handle.clone()); + lock.insert(i, Arc::clone(&handle)); } handle @@ -120,7 +120,7 @@ impl Manager { provided: &mut HashMap>, permissive: bool, ) -> Result<(), Error> { - let handle = supervisors.get(name).ok_or(Error::NotStarted)?.clone(); + let handle = Arc::clone(supervisors.get(name).ok_or(Error::NotStarted)?); let queried = handle.query().await; let is_providing = |provided: &mut HashMap<_, _>, i| { @@ -304,7 +304,7 @@ impl Supervisor { Request::MakeActive(chan) => { match &self.current_task.0 { Some(task) => match task.task_class() { - "StartService" => chan.send(Ok(task.clone())).ok(), + "StartService" => chan.send(Ok(Arc::clone(task))).ok(), _ => chan.send(Err(Error::TaskExists)).ok(), }, None => match self.user_start_service().await { @@ -428,7 +428,7 @@ impl Supervisor { self.timers.on_start(); self.current_task ._start_task(&self.context, async { - task::start::start(self.context.clone()) + task::start::start(Arc::clone(&self.context)) }) .await } @@ -437,7 +437,7 @@ impl Supervisor { async fn stop_service(&mut self) -> Result, Error> { self.current_task ._start_task(&self.context, async { - task::stop::start(self.context.clone()) + task::stop::start(Arc::clone(&self.context)) }) .await } @@ -473,7 +473,7 @@ impl Supervisor { async fn cleanup_service(&mut self, wait: Wait) -> Result, Error> { self.current_task ._start_task(&self.context, async { - task::cleanup::start(self.context.clone(), wait) + task::cleanup::start(Arc::clone(&self.context), wait) }) .await }