World folder is the source of truth
- actor/<id>/ holds actor.wasm, actor.json, source/, public/, data/, versions/ - the broker boots by scanning actor/; a changed actor.wasm is an upgrade, a rejected one stays in versions/ with a reason and the files come back - /actor hides every data/ folder - subscriptions live in the subscriber's actor.json - cargo installs the SDK and points sausage-actor at it; no build limits - PROTOCOL.md
This commit is contained in:
@@ -110,7 +110,9 @@ pub async fn test(
|
||||
}
|
||||
|
||||
fn start(broker: &Broker, id: &str, component: &Component, data: Option<&Path>, public: Option<&Path>) -> Result<(Instance, Scratch)> {
|
||||
let dir = broker.world.scratch_dir().join(format!("{id}-{}-{}", world::now(), rand_suffix()));
|
||||
static N: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0);
|
||||
let n = N.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
|
||||
let dir = broker.world.scratch_dir().join(format!("{id}-{}-{n}", std::process::id()));
|
||||
let scratch = Scratch { dir: dir.clone() };
|
||||
std::fs::create_dir_all(dir.join("data"))?;
|
||||
std::fs::create_dir_all(dir.join("public"))?;
|
||||
@@ -133,13 +135,6 @@ fn start(broker: &Broker, id: &str, component: &Component, data: Option<&Path>,
|
||||
Ok((broker.runtime.start(component, cfg)?, scratch))
|
||||
}
|
||||
|
||||
fn rand_suffix() -> u32 {
|
||||
use std::hash::{BuildHasher, Hasher};
|
||||
let mut h = std::collections::hash_map::RandomState::new().build_hasher();
|
||||
h.write_u64(std::process::id() as u64);
|
||||
h.finish() as u32
|
||||
}
|
||||
|
||||
async fn run_file(
|
||||
broker: &Broker,
|
||||
id: &str,
|
||||
|
||||
Reference in New Issue
Block a user