core: seams for parallel work: services.rs (boot), graph.rs (documents for /proc), activation.rs

This commit is contained in:
2026-10-23 00:34:34 +01:00
parent 8542b9fcb8
commit ae1cb4cc99
6 changed files with 82 additions and 17 deletions
+31
View File
@@ -0,0 +1,31 @@
//! Services: the calls in `/config/boot.json` (PROTOCOL.md section 8). The
//! core starts them in order at boot.
use crate::Host;
use serde_json::{Value, json};
use uuid::Uuid;
impl Host {
/// Start each service of `/config/boot.json` as a detached call with the
/// parent `core`, in order. A failure goes to the journal, and boot
/// continues.
pub(crate) async fn boot(&self) -> anyhow::Result<()> {
let boot: Vec<Value> = serde_json::from_slice(
&tokio::fs::read(self.0.world.root.join("config/boot.json")).await?,
)?;
for service in boot {
let result = self
.route(
"core".into(),
Some(json!(Uuid::now_v7().to_string())),
service["method"].as_str().unwrap_or("").into(),
service["params"].clone(),
true,
)
.await;
if let Err(e) = result {
self.0.journal.write("core", "core", "core", &e.to_string());
}
}
Ok(())
}
}