Skip to content

Commit

Permalink
[Release] Airup v0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sisungo committed Dec 30, 2023
1 parent ceb1bdd commit 2fc224e
Show file tree
Hide file tree
Showing 13 changed files with 99 additions and 34 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
Changes in v0.6.0:
* [Feature] Implement delayed retrying
* [Feature] `airup debug --use-logger` and `airup debug --print-build-manifest` CLI utilities
* [Feature] `airup enable` and `airup disable` CLI utilities
* [Feature] `airup stop --force` CLI utility and `system.kill_service` API
* [Feature] Allow specifying reboot/poweroff/halt timeout
* [Feature] Support `health-check`-kinded watchdogs
* [Internals] Task importance measurement
* [Fix] Potential race condition in Unix process subsystem
* [Fix] Unexpected logging in `reboot` milestone
* [Developer] Move `SystemConf` structure from `airupd` to `airup-sdk`
* ACE performance optimization

Changes in v0.5.0:
* [Feature] Gracefully reboot
* [Feature] Support of recording of service logs
Expand Down
8 changes: 5 additions & 3 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ To build Airup, you need to install the few dependencies first:
Some build dependencies are optional, as they are only required when the feature is used:
- [cbindgen](https://github.com/mozilla/cbindgen): A tool to generated C headers from Rust code.

Airup requires `Rust 1.75.0` or newer to compile.

## Configuration
Some Airup functions are configured at build time. The build manifest which is located at `build_manifest.rs` stores primitive
configuration items that cannot be set at runtime. Its example is at `docs/resources/build_manifest.rs`. Definitions to its
items:
Some Airup functions are configured at build time. The build manifest which is located at `build_manifest.json` stores primitive
paths that cannot be set at runtime or default values of `system.conf` items. An example file is located
at `docs/resources/build_manifest.json`. There is a list that describes all available configuration items:
- `os_name`: Name of the OS build.
- `config_dir`: Path of Airup's configuration directory, which stores service/system config files, etc.
- `service_dir`: Path of Airup's service directory, which stores service files.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ supervisor or the `init` daemon (`pid == 1`).

## Project Status
Maintained Versions:
- Current Mainline Version: `0.5.0`
- Current Release Version: `0.5.0`
- Current Mainline Version: `0.6.0`
- Current Release Version: `0.6.0`

⚠️ **WARNING**: The project is currently in **unstable** stage and should **NOT** be used in production environments. It may contain errors, bugs or quality issues. Welcome to open an issue to report bugs.

Expand Down
4 changes: 2 additions & 2 deletions 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.5.0"
version = "0.6.0"
edition = "2021"
license = "MIT"

Expand All @@ -23,5 +23,5 @@ json-patch = "1"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tokio = { version = "1", features = ["net", "fs", "io-util"] }
toml = "0.7"
toml = "0.8"
thiserror = "1"
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.5.0"
version = "0.6.0"
edition = "2021"
license = "MIT"
publish = false
Expand Down
4 changes: 2 additions & 2 deletions 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.5.0"
version = "0.6.0"
edition = "2021"
license = "MIT"
publish = false
Expand All @@ -25,5 +25,5 @@ serde = "1"
serde_json = "1"
thiserror = "1"
tokio = { workspace = true }
toml = "0.7"
toml = "0.8"
tracing = "0.1"
4 changes: 2 additions & 2 deletions airupfx/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "airupfx"
authors = ["sisungo <[email protected]>"]
version = "0.5.0"
version = "0.6.0"
edition = "2021"
license = "MIT"
publish = false
Expand All @@ -20,7 +20,7 @@ libc = "0.2"
mini-moka = "0.10"
once_cell = "1"
shlex = "1.2"
sysinfo = { version = "0.29", features = ["serde"] }
sysinfo = { version = "0.30", features = ["serde"] }
thiserror = "1"
tokio = { workspace = true }
tracing = "0.1"
Expand Down
11 changes: 2 additions & 9 deletions airupfx/src/env/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,7 @@ pub mod users;

pub use users::{current_uid, with_current_user, with_user_by_id, with_user_by_name};

use once_cell::sync::Lazy;
use std::{
ffi::{OsStr, OsString},
sync::RwLock,
};
use sysinfo::SystemExt;

static SYSINFO: Lazy<RwLock<sysinfo::System>> = Lazy::new(|| RwLock::new(sysinfo::System::new()));
use std::ffi::{OsStr, OsString};

/// Sets environment variables in the iterator for the currently running process, removing environment variables with value
/// `None`.
Expand Down Expand Up @@ -54,5 +47,5 @@ pub async fn refresh() {
/// Returns host name of the machine currently running the process.
#[inline]
pub fn host_name() -> Option<String> {
SYSINFO.read().unwrap().host_name()
sysinfo::System::host_name()
}
17 changes: 6 additions & 11 deletions airupfx/src/env/users.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@
use once_cell::sync::Lazy;
use std::sync::RwLock;
use sysinfo::{SystemExt, Uid, User, UserExt};
use sysinfo::{Uid, User};

static USERS: Lazy<RwLock<sysinfo::System>> = Lazy::new(|| {
let mut instance = sysinfo::System::new();
instance.refresh_users_list();
instance.into()
});
static USERS: Lazy<RwLock<sysinfo::Users>> =
Lazy::new(|| sysinfo::Users::new_with_refreshed_list().into());
static CACHE: Lazy<mini_moka::sync::Cache<Request, Option<usize>, ahash::RandomState>> =
Lazy::new(|| {
mini_moka::sync::Cache::builder()
Expand All @@ -19,7 +16,7 @@ static CACHE: Lazy<mini_moka::sync::Cache<Request, Option<usize>, ahash::RandomS

/// Refreshes users database.
pub fn refresh() {
USERS.write().unwrap().refresh_users_list();
USERS.write().unwrap().refresh_list();
CACHE.invalidate_all();
}

Expand All @@ -29,15 +26,14 @@ pub fn with_user_by_id<F: FnOnce(&User) -> T, T>(uid: &Uid, f: F) -> Option<T> {
let req = Request::FindUserById(uid.clone());
let numeric = CACHE.get(&req).unwrap_or_else(|| {
let value = users
.users()
.iter()
.enumerate()
.find(|(_, u)| u.id() == uid)
.map(|x| x.0);
CACHE.insert(req, value);
value
});
numeric.map(|i| f(users.users().get(i).unwrap()))
numeric.map(|i| f(users.get(i).unwrap()))
}

/// Finds a user entry by username.
Expand All @@ -46,15 +42,14 @@ pub fn with_user_by_name<F: FnOnce(&User) -> T, T>(name: &str, f: F) -> Option<T
let req = Request::FindUserByName(name.into());
let numeric = CACHE.get(&req).unwrap_or_else(|| {
let value = users
.users()
.iter()
.enumerate()
.find(|(_, u)| u.name() == name)
.map(|x| x.0);
CACHE.insert(req, value);
value
});
numeric.map(|i| f(users.users().get(i).unwrap()))
numeric.map(|i| f(users.get(i).unwrap()))
}

/// Returns the user entry of current user.
Expand Down
5 changes: 4 additions & 1 deletion airupfx/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
//! # AirupFX
//! Base support library of Airup.
//! Base OS support library of Airup. This is internal to the `airup` project and is NOT subjected to be published as a part of
//! the Airup SDK.
//!
//! Since Airup v0.5.0, AirupFX version is no longer synced with other components.
pub mod ace;
pub mod env;
Expand Down
1 change: 0 additions & 1 deletion airupfx/src/sys/unix/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use std::{
sync::{Arc, OnceLock, RwLock},
time::Duration,
};
use sysinfo::UserExt;
use tokio::{signal::unix::SignalKind, sync::watch};

pub type Pid = libc::pid_t;
Expand Down
30 changes: 30 additions & 0 deletions docs/en-US/api_manual/ipc/system.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ Module `system` provides methods for managing the system.
- Return Value: `QuerySystem` object
- Description: Returns queried macro information about the whole system.

## Method: `system.list_services`
- Name: `system.list_services`
- Parameters: None
- Return Value: `string` array
- Description: Returns a list over names of all installed services on the system.

## Method: `system.start_service`
- Name: `system.start_service`
- Parameters: `string (name of service to operate)`
Expand All @@ -37,6 +43,30 @@ Module `system` provides methods for managing the system.
- Return Value: `null`
- Description: Stops the specified service.

## Method: `system.cache_service`
- Name: `system.cache_service`
- Parameters: `string (name of service to operate)`
- Return Value: `null`
- Description: Caches the specified service.

## Method: `system.uncache_service`
- Name: `system.uncache_service`
- Parameters: `string (name of service to operate)`
- Return Value: `null`
- Description: Uncaches the specified service.

## Method: `system.sideload_service`
- Name: `system.sideload_service`
- Parameters: `string (name of service)`, `Service` object
- Return Value: `null`
- Description: Sideloads the given service in given name.

## Method: `system.unsideload_service`
- Name: `system.unsideload_service`
- Parameters: `string (name of service to operate)`
- Return Value: `null`
- Description: Removes the specified service from sideload store.

## Method: `system.kill_service`
- Name: `system.kill_service`
- Parameters: `string (name of service to operate)`
Expand Down
30 changes: 30 additions & 0 deletions docs/zh-CN/api_manual/ipc/system.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
- 返回值:`QuerySystem` 对象
- 描述:返回查询到的关于整个系统的宏观信息。

## `system.list_services` 方法
- 名称:`system.list_services`
- 参数:无
- 返回值:`string` 数组
- 描述:返回系统中已安装的所有服务的名称的列表。

## `system.start_service` 方法
- 名称:`system.start_service`
- 参数:`字符串(要操作的服务名称)`
Expand All @@ -37,6 +43,30 @@
- 返回值:`null`
- 描述:停止指定的服务。

## `system.cache_service` 方法
- 名称:`system.cache_service`
- 参数:`字符串(要操作的服务名称)`
- 返回值:`null`
- 描述:缓存指定的服务。

## `system.uncache_service` 方法
- 名称:`system.uncache_service`
- 参数:`字符串(要操作的服务名称)`
- 返回值:`null`
- 描述:取消缓存指定的服务。

## `system.sideload_service` 方法
- 名称:`system.sideload_service`
- 参数:`字符串(服务名称)`, `Service` 对象
- 返回值:`null`
- 描述:以指定名称侧载给出的服务。

## `system.unsideload_service` 方法
- 名称:`system.unsideload_service`
- 参数:`字符串(要操作的服务名称)`
- 返回值:`null`
- 描述:从侧载存储删除指定服务。

## `system.kill_service` 方法
- 名称:`system.kill_service`
- 参数:`字符串(要操作的服务名称)`
Expand Down

0 comments on commit 2fc224e

Please sign in to comment.