Skip to content

Commit

Permalink
release: airup v0.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sisungo committed May 2, 2024
1 parent b9cec54 commit a36d5ff
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 51 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion airup-sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ authors = ["sisungo <[email protected]>"]
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"

Expand Down
2 changes: 1 addition & 1 deletion airup/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "airup"
authors = ["sisungo <[email protected]>"]
version = "0.10.0-rc.5"
version = "0.10.0"
edition = "2021"
license = "MIT"
publish = false
Expand Down
46 changes: 8 additions & 38 deletions airup/src/reboot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
2 changes: 1 addition & 1 deletion airupd/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "airupd"
authors = ["sisungo <[email protected]>"]
version = "0.10.0-rc.5"
version = "0.10.0"
edition = "2021"
license = "MIT"
publish = false
Expand Down
4 changes: 2 additions & 2 deletions airupd/src/extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions airupd/src/milestones/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<EnteredMilestone> {
self.stack.read().unwrap().clone()
}
Expand Down
14 changes: 7 additions & 7 deletions airupd/src/supervisor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -120,7 +120,7 @@ impl Manager {
provided: &mut HashMap<String, Arc<SupervisorHandle>>,
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| {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
Expand All @@ -437,7 +437,7 @@ impl Supervisor {
async fn stop_service(&mut self) -> Result<Arc<dyn TaskHandle>, Error> {
self.current_task
._start_task(&self.context, async {
task::stop::start(self.context.clone())
task::stop::start(Arc::clone(&self.context))
})
.await
}
Expand Down Expand Up @@ -473,7 +473,7 @@ impl Supervisor {
async fn cleanup_service(&mut self, wait: Wait) -> Result<Arc<dyn TaskHandle>, 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
}
Expand Down

0 comments on commit a36d5ff

Please sign in to comment.