mirror of
https://github.com/uqbar-dao/nectar.git
synced 2024-12-22 16:11:38 +03:00
WIP: sys:nectar -> distro:sys, userspace modules to sys for publisher
This commit is contained in:
parent
94bac2de4b
commit
693d75d9e2
50
README.md
50
README.md
@ -38,8 +38,38 @@ cargo +nightly run --release -- home --rpc wss://eth-sepolia.g.alchemy.com/v2/<y
|
||||
|
||||
On boot you will be prompted to navigate to `localhost:8080`. Make sure your ETH wallet is connected to the Sepolia test network. Login should be straightforward, just submit the transactions and follow the flow. If you want to register a new ID you will either need [Sepolia testnet tokens](https://www.infura.io/faucet/sepolia) or an invite code.
|
||||
|
||||
### Distro and Runtime processes
|
||||
|
||||
## Terminal syntax
|
||||
The base OS install comes with certain runtime modules. These are interacted with in the same way as userspace processes, but are deeply ingrained to the system and the APIs they present at their Process IDs are assumed to be available by userspace processes. All of these are identified in the `distro:sys` package.
|
||||
|
||||
This distribution of the OS also comes with userspace packages pre-installed. Some of these packages are intimately tied to the runtime: `terminal`, `homepage`, and `ndns_indexer`. Modifying, removing or replacing the distro userspace packages should only be done in highly specialized use-cases.
|
||||
|
||||
The runtime distro processes are:
|
||||
|
||||
- `eth:distro:sys`
|
||||
- `http_client:distro:sys`
|
||||
- `http_server:distro:sys`
|
||||
- `kernel:distro:sys`
|
||||
- `kv:distro:sys`
|
||||
- `net:distro:sys`
|
||||
- `state:distro:sys`
|
||||
- `terminal:distro:sys`
|
||||
- `timer:distro:sys`
|
||||
- `sqlite:distro:sys`
|
||||
- `vfs:distro:sys`
|
||||
|
||||
The distro userspace packages are:
|
||||
|
||||
- `app_store:sys`
|
||||
- `chess:sys`
|
||||
- `homepage:sys`
|
||||
- `ndns_indexer:sys`
|
||||
- `terminal:sys`
|
||||
- `tester:sys` (only installed in if compiled with feature flag `simulation-mode`)
|
||||
|
||||
The `sys` publisher is not a real node ID, but it's also not a special case value. Packages, whether runtime or userspace, installed from disk when a node bootstraps do not have their package ID or publisher node ID validated. Packages installed (not injected locally, as is done during development) after a node has booted will have their publisher field validated.
|
||||
|
||||
### Terminal syntax
|
||||
|
||||
- CTRL+C or CTRL+D to gracefully shutdown node
|
||||
- CTRL+V to toggle through verbose modes (0-3, 0 is default and lowest verbosity)
|
||||
@ -55,27 +85,27 @@ On boot you will be prompted to navigate to `localhost:8080`. Make sure your ETH
|
||||
- CTRL+R to search history, CTRL+R again to toggle through search results, CTRL+G to cancel search
|
||||
|
||||
- `/message <address> <json>`: send an inter-process message. <address> is formatted as <node>@<process_id>. <process_id> is formatted as <process_name>:<package_name>:<publisher_node>.
|
||||
- Example: `/message our@net:sys:nectar diagnostics`
|
||||
- Example: `/message our@net:distro:sys diagnostics`
|
||||
- `our` will always be interpolated by the system as your node's name
|
||||
- Can also use `/m` for same command: `/m our@net:sys:nectar diagnostics`
|
||||
- Can also use `/m` for same command: `/m our@net:distro:sys diagnostics`
|
||||
- `/app <address>`: set the terminal to a mode where all messages go to a specific app. To clear this selection, use `/app clear` or simply `/app`. This is useful for apps that have a command line interface.
|
||||
- Example: `/app our@net:sys:nectar`, then `/m diagnostics`
|
||||
- Can also use `/a` for same command: `/a our@net:sys:nectar`
|
||||
- Example: `/app our@net:distro:sys`, then `/m diagnostics`
|
||||
- Can also use `/a` for same command: `/a our@net:distro:sys`
|
||||
- Example of sending many messages:
|
||||
- `/a ben.os@net:sys:nectar`
|
||||
- `/a ben.os@net:distro:sys`
|
||||
- `/m hey there`
|
||||
- `/m how are you?`
|
||||
- `/a` (to exit app mode)
|
||||
- `/hi <name> <string>`: send a text message to another node's command line.
|
||||
- Example: `/hi ben.os hello world`
|
||||
- `/top <process_id>`: display kernel debugging info about a process. Leave the process ID blank to display info about all processes and get the total number of running processes.
|
||||
- Example: `/top net:sys:nectar`
|
||||
- Example: `/top net:distro:sys`
|
||||
- Example: `/top`
|
||||
|
||||
## Example usage
|
||||
### Terminal example usage
|
||||
|
||||
Download and install an app:
|
||||
```
|
||||
/m our@main:app_store:nectar {"Download": {"package": {"package_name": "<pkg>", "publisher_node": "<node>"}, "install_from": "<node>"}}
|
||||
/m our@main:app_store:nectar {"Install": {"package_name": "<pkg>", "publisher_node": "<node>"}}
|
||||
/m our@main:app_store:sys {"Download": {"package": {"package_name": "<pkg>", "publisher_node": "<node>"}, "install_from": "<node>"}}
|
||||
/m our@main:app_store:sys {"Install": {"package_name": "<pkg>", "publisher_node": "<node>"}}
|
||||
```
|
||||
|
@ -178,7 +178,7 @@ struct ManifestCap {
|
||||
|
||||
call_init!(init);
|
||||
fn init(our: Address) {
|
||||
println!("{}: running", our.process);
|
||||
println!("{}: started", our.package());
|
||||
|
||||
// load in our saved state or initalize a new one if none exists
|
||||
let mut state = get_typed_state(|bytes| Ok(bincode::deserialize(bytes)?)).unwrap_or(State {
|
||||
@ -346,7 +346,7 @@ fn handle_new_package(
|
||||
|
||||
// create a new drive for this package in VFS
|
||||
Request::new()
|
||||
.target(("our", "vfs", "sys", "nectar"))
|
||||
.target(("our", "vfs", "distro", "sys"))
|
||||
.body(serde_json::to_vec(&vfs::VfsRequest {
|
||||
path: drive.clone(),
|
||||
action: vfs::VfsAction::CreateDrive,
|
||||
@ -361,7 +361,7 @@ fn handle_new_package(
|
||||
// add zip bytes
|
||||
blob.mime = Some("application/zip".to_string());
|
||||
let response = Request::new()
|
||||
.target(("our", "vfs", "sys", "nectar"))
|
||||
.target(("our", "vfs", "distro", "sys"))
|
||||
.body(serde_json::to_vec(&vfs::VfsRequest {
|
||||
path: drive.clone(),
|
||||
action: vfs::VfsAction::AddZip,
|
||||
@ -379,7 +379,7 @@ fn handle_new_package(
|
||||
// call it <package>.zip
|
||||
let zip_path = format!("{}/{}.zip", drive.clone(), package);
|
||||
Request::new()
|
||||
.target(("our", "vfs", "sys", "nectar"))
|
||||
.target(("our", "vfs", "distro", "sys"))
|
||||
.inherit(true)
|
||||
.body(serde_json::to_vec(&vfs::VfsRequest {
|
||||
path: zip_path,
|
||||
@ -392,7 +392,7 @@ fn handle_new_package(
|
||||
// now, read the pkg contents to create our own listing and state,
|
||||
// such that we can mirror this package to others.
|
||||
Request::new()
|
||||
.target(("our", "vfs", "sys", "nectar"))
|
||||
.target(("our", "vfs", "distro", "sys"))
|
||||
.body(serde_json::to_vec(&vfs::VfsRequest {
|
||||
path: metadata_path,
|
||||
action: vfs::VfsAction::Read,
|
||||
@ -427,7 +427,7 @@ fn handle_new_package(
|
||||
fn handle_install(our: &Address, package: &PackageId) -> anyhow::Result<()> {
|
||||
let drive_path = format!("/{}/pkg", package);
|
||||
Request::new()
|
||||
.target(("our", "vfs", "sys", "nectar"))
|
||||
.target(("our", "vfs", "distro", "sys"))
|
||||
.body(serde_json::to_vec(&vfs::VfsRequest {
|
||||
path: format!("{}/manifest.json", drive_path),
|
||||
action: vfs::VfsAction::Read,
|
||||
@ -440,7 +440,7 @@ fn handle_install(our: &Address, package: &PackageId) -> anyhow::Result<()> {
|
||||
let manifest = serde_json::from_str::<Vec<kt::PackageManifestEntry>>(&manifest)?;
|
||||
// always grant read/write to their drive, which we created for them
|
||||
let Some(read_cap) = get_capability(
|
||||
&Address::new(&our.node, ("vfs", "sys", "nectar")),
|
||||
&Address::new(&our.node, ("vfs", "distro", "sys")),
|
||||
&serde_json::to_string(&serde_json::json!({
|
||||
"kind": "read",
|
||||
"drive": drive_path,
|
||||
@ -449,7 +449,7 @@ fn handle_install(our: &Address, package: &PackageId) -> anyhow::Result<()> {
|
||||
return Err(anyhow::anyhow!("app store: no read cap"));
|
||||
};
|
||||
let Some(write_cap) = get_capability(
|
||||
&Address::new(&our.node, ("vfs", "sys", "nectar")),
|
||||
&Address::new(&our.node, ("vfs", "distro", "sys")),
|
||||
&serde_json::to_string(&serde_json::json!({
|
||||
"kind": "write",
|
||||
"drive": drive_path,
|
||||
@ -458,7 +458,7 @@ fn handle_install(our: &Address, package: &PackageId) -> anyhow::Result<()> {
|
||||
return Err(anyhow::anyhow!("app store: no write cap"));
|
||||
};
|
||||
let Some(networking_cap) = get_capability(
|
||||
&Address::new(&our.node, ("kernel", "sys", "nectar")),
|
||||
&Address::new(&our.node, ("kernel", "distro", "sys")),
|
||||
&"\"network\"".to_string(),
|
||||
) else {
|
||||
return Err(anyhow::anyhow!("app store: no net cap"));
|
||||
@ -486,14 +486,14 @@ fn handle_install(our: &Address, package: &PackageId) -> anyhow::Result<()> {
|
||||
};
|
||||
// kill process if it already exists
|
||||
Request::new()
|
||||
.target(("our", "kernel", "sys", "nectar"))
|
||||
.target(("our", "kernel", "distro", "sys"))
|
||||
.body(serde_json::to_vec(&kt::KernelCommand::KillProcess(
|
||||
parsed_new_process_id.clone(),
|
||||
))?)
|
||||
.send()?;
|
||||
|
||||
let _bytes_response = Request::new()
|
||||
.target(("our", "vfs", "sys", "nectar"))
|
||||
.target(("our", "vfs", "distro", "sys"))
|
||||
.body(serde_json::to_vec(&vfs::VfsRequest {
|
||||
path: wasm_path.clone(),
|
||||
action: vfs::VfsAction::Read,
|
||||
@ -556,7 +556,7 @@ fn handle_install(our: &Address, package: &PackageId) -> anyhow::Result<()> {
|
||||
}
|
||||
}
|
||||
Request::new()
|
||||
.target(("our", "kernel", "sys", "nectar"))
|
||||
.target(("our", "kernel", "distro", "sys"))
|
||||
.body(serde_json::to_vec(&kt::KernelCommand::InitializeProcess {
|
||||
id: parsed_new_process_id.clone(),
|
||||
wasm_bytes_handle: wasm_path,
|
||||
@ -573,7 +573,7 @@ fn handle_install(our: &Address, package: &PackageId) -> anyhow::Result<()> {
|
||||
serde_json::Value::String(process_name) => {
|
||||
if let Ok(parsed_process_id) = process_name.parse::<ProcessId>() {
|
||||
let _ = Request::new()
|
||||
.target(("our", "kernel", "sys", "nectar"))
|
||||
.target(("our", "kernel", "distro", "sys"))
|
||||
.body(
|
||||
serde_json::to_vec(&kt::KernelCommand::GrantCapabilities {
|
||||
target: parsed_process_id,
|
||||
@ -599,7 +599,7 @@ fn handle_install(our: &Address, package: &PackageId) -> anyhow::Result<()> {
|
||||
{
|
||||
if let Some(params) = map.get("params") {
|
||||
let _ = Request::new()
|
||||
.target(("our", "kernel", "sys", "nectar"))
|
||||
.target(("our", "kernel", "distro", "sys"))
|
||||
.body(
|
||||
serde_json::to_vec(
|
||||
&kt::KernelCommand::GrantCapabilities {
|
||||
@ -627,7 +627,7 @@ fn handle_install(our: &Address, package: &PackageId) -> anyhow::Result<()> {
|
||||
}
|
||||
}
|
||||
Request::new()
|
||||
.target(("our", "kernel", "sys", "nectar"))
|
||||
.target(("our", "kernel", "distro", "sys"))
|
||||
.body(serde_json::to_vec(&kt::KernelCommand::RunProcess(
|
||||
parsed_new_process_id,
|
||||
))?)
|
||||
@ -639,7 +639,7 @@ fn handle_install(our: &Address, package: &PackageId) -> anyhow::Result<()> {
|
||||
fn handle_uninstall(package: &PackageId) -> anyhow::Result<()> {
|
||||
let drive_path = format!("/{}/pkg", package);
|
||||
Request::new()
|
||||
.target(("our", "vfs", "sys", "nectar"))
|
||||
.target(("our", "vfs", "distro", "sys"))
|
||||
.body(serde_json::to_vec(&vfs::VfsRequest {
|
||||
path: format!("{}/manifest.json", drive_path),
|
||||
action: vfs::VfsAction::Read,
|
||||
@ -657,7 +657,7 @@ fn handle_uninstall(package: &PackageId) -> anyhow::Result<()> {
|
||||
continue;
|
||||
};
|
||||
Request::new()
|
||||
.target(("our", "kernel", "sys", "nectar"))
|
||||
.target(("our", "kernel", "distro", "sys"))
|
||||
.body(serde_json::to_vec(&kt::KernelCommand::KillProcess(
|
||||
parsed_new_process_id,
|
||||
))?)
|
||||
@ -665,7 +665,7 @@ fn handle_uninstall(package: &PackageId) -> anyhow::Result<()> {
|
||||
}
|
||||
// then, delete the drive
|
||||
Request::new()
|
||||
.target(("our", "vfs", "sys", "nectar"))
|
||||
.target(("our", "vfs", "distro", "sys"))
|
||||
.body(serde_json::to_vec(&vfs::VfsRequest {
|
||||
path: drive_path,
|
||||
action: vfs::VfsAction::RemoveDirAll,
|
||||
@ -691,7 +691,7 @@ fn handle_remote_request(
|
||||
// get the .zip from VFS and attach as blob to response
|
||||
let file_path = format!("/{}/pkg/{}.zip", package, package);
|
||||
let Ok(Ok(_)) = Request::new()
|
||||
.target(("our", "vfs", "sys", "nectar"))
|
||||
.target(("our", "vfs", "distro", "sys"))
|
||||
.body(
|
||||
serde_json::to_vec(&vfs::VfsRequest {
|
||||
path: file_path,
|
||||
|
@ -5,25 +5,25 @@
|
||||
"on_exit": "Restart",
|
||||
"request_networking": true,
|
||||
"request_capabilities": [
|
||||
"terminal:terminal:nectar",
|
||||
"filesystem:sys:nectar",
|
||||
"http_server:sys:nectar",
|
||||
"http_client:sys:nectar",
|
||||
"net:sys:nectar",
|
||||
"vfs:sys:nectar",
|
||||
"kernel:sys:nectar",
|
||||
"eth:sys:nectar",
|
||||
"terminal:terminal:sys",
|
||||
"filesystem:distro:sys",
|
||||
"http_server:distro:sys",
|
||||
"http_client:distro:sys",
|
||||
"net:distro:sys",
|
||||
"vfs:distro:sys",
|
||||
"kernel:distro:sys",
|
||||
"eth:distro:sys",
|
||||
{
|
||||
"process": "vfs:sys:nectar",
|
||||
"process": "vfs:distro:sys",
|
||||
"params": {
|
||||
"root": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"grant_capabilities": [
|
||||
"http_server:sys:nectar",
|
||||
"terminal:terminal:nectar",
|
||||
"vfs:sys:nectar"
|
||||
"http_server:distro:sys",
|
||||
"terminal:terminal:sys",
|
||||
"vfs:distro:sys"
|
||||
],
|
||||
"public": false
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"package": "app_store",
|
||||
"publisher": "nectar",
|
||||
"publisher": "sys",
|
||||
"version": [
|
||||
0,
|
||||
2,
|
||||
|
@ -73,7 +73,7 @@ fn load_chess_state() -> ChessState {
|
||||
fn send_ws_update(our: &Address, game: &Game, open_channels: &HashSet<u32>) -> anyhow::Result<()> {
|
||||
for channel in open_channels {
|
||||
Request::new()
|
||||
.target((&our.node, "http_server", "sys", "nectar"))
|
||||
.target((&our.node, "http_server", "distro", "sys"))
|
||||
.body(serde_json::to_vec(
|
||||
&http::HttpServerAction::WebSocketPush {
|
||||
channel_id: *channel,
|
||||
@ -108,7 +108,7 @@ call_init!(initialize);
|
||||
|
||||
fn initialize(our: Address) {
|
||||
// A little printout to show in terminal that the process has started.
|
||||
println!("{} by {}: start", our.process(), our.publisher());
|
||||
println!("{}: started", our.package());
|
||||
|
||||
// Serve the index.html and other UI files found in pkg/ui at the root path.
|
||||
http::serve_ui(&our, "ui").unwrap();
|
||||
@ -168,14 +168,14 @@ fn handle_request(our: &Address, message: &Message, state: &mut ChessState) -> a
|
||||
// Note that since this is a local request, we *can* trust the ProcessId.
|
||||
// Here, we'll accept messages from the local terminal so as to make this a "CLI" app.
|
||||
} else if message.source().node == our.node
|
||||
&& message.source().process == "terminal:terminal:nectar"
|
||||
&& message.source().process == "terminal:terminal:sys"
|
||||
{
|
||||
let Ok(chess_request) = serde_json::from_slice::<ChessRequest>(message.body()) else {
|
||||
return Err(anyhow::anyhow!("invalid chess request"));
|
||||
};
|
||||
handle_local_request(our, state, &chess_request)
|
||||
} else if message.source().node == our.node
|
||||
&& message.source().process == "http_server:sys:nectar"
|
||||
&& message.source().process == "http_server:distro:sys"
|
||||
{
|
||||
// receive HTTP requests and websocket connection messages from our server
|
||||
match serde_json::from_slice::<http::HttpServerRequest>(message.body())? {
|
||||
|
@ -5,12 +5,12 @@
|
||||
"on_exit": "Restart",
|
||||
"request_networking": true,
|
||||
"request_capabilities": [
|
||||
"http_server:sys:nectar",
|
||||
"net:sys:nectar",
|
||||
"vfs:sys:nectar"
|
||||
"http_server:distro:sys",
|
||||
"net:distro:sys",
|
||||
"vfs:distro:sys"
|
||||
],
|
||||
"grant_capabilities": [
|
||||
"http_server:sys:nectar"
|
||||
"http_server:distro:sys"
|
||||
],
|
||||
"public": true
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"package": "chess",
|
||||
"publisher": "nectar",
|
||||
"publisher": "sys",
|
||||
"version": [
|
||||
0,
|
||||
2,
|
||||
|
@ -65,7 +65,7 @@ fn main(our: Address) -> anyhow::Result<()> {
|
||||
continue;
|
||||
};
|
||||
if let Message::Response { source, body, .. } = message
|
||||
&& source.process == "http_server:sys:nectar"
|
||||
&& source.process == "http_server:distro:sys"
|
||||
{
|
||||
match serde_json::from_slice::<Result<(), HttpServerError>>(&body) {
|
||||
Ok(Ok(())) => continue,
|
||||
|
@ -5,10 +5,10 @@
|
||||
"on_exit": "Restart",
|
||||
"request_networking": false,
|
||||
"request_capabilities": [
|
||||
"http_server:sys:nectar"
|
||||
"http_server:distro:sys"
|
||||
],
|
||||
"grant_capabilities": [
|
||||
"http_server:sys:nectar"
|
||||
"http_server:distro:sys"
|
||||
],
|
||||
"public": false
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"package": "homepage",
|
||||
"publisher": "nectar",
|
||||
"publisher": "sys",
|
||||
"version": [
|
||||
0,
|
||||
1,
|
||||
|
@ -114,7 +114,7 @@ fn main(our: Address, mut state: State) -> anyhow::Result<()> {
|
||||
let Ok(Message::Request { source, body, .. }) = await_message() else {
|
||||
continue;
|
||||
};
|
||||
if source.process != "kernel:sys:nectar" {
|
||||
if source.process != "kernel:distro:sys" {
|
||||
continue;
|
||||
}
|
||||
contract_address = Some(std::str::from_utf8(&body).unwrap().to_string());
|
||||
@ -135,7 +135,7 @@ fn main(our: Address, mut state: State) -> anyhow::Result<()> {
|
||||
}
|
||||
// shove all state into net::net
|
||||
Request::new()
|
||||
.target((&our.node, "net", "sys", "nectar"))
|
||||
.target((&our.node, "net", "distro", "sys"))
|
||||
.try_body(NetActions::NdnsBatchUpdate(
|
||||
state.nodes.values().cloned().collect::<Vec<_>>(),
|
||||
))?
|
||||
@ -166,7 +166,7 @@ fn main(our: Address, mut state: State) -> anyhow::Result<()> {
|
||||
continue;
|
||||
};
|
||||
|
||||
if source.process == "http_server:sys:nectar" {
|
||||
if source.process == "http_server:distro:sys" {
|
||||
if let Ok(body_json) = serde_json::from_slice::<serde_json::Value>(&body) {
|
||||
if body_json["path"].as_str().unwrap_or_default() == "/node/:name" {
|
||||
if let Some(name) = body_json["url_params"]["name"].as_str() {
|
||||
@ -279,7 +279,7 @@ fn main(our: Address, mut state: State) -> anyhow::Result<()> {
|
||||
),
|
||||
);
|
||||
Request::new()
|
||||
.target((&our.node, "net", "sys", "nectar"))
|
||||
.target((&our.node, "net", "distro", "sys"))
|
||||
.try_body(NetActions::NdnsUpdate(node.clone()))?
|
||||
.send()?;
|
||||
}
|
||||
|
@ -5,13 +5,13 @@
|
||||
"on_exit": "Restart",
|
||||
"request_networking": false,
|
||||
"request_capabilities": [
|
||||
"eth:sys:nectar",
|
||||
"http_server:sys:nectar",
|
||||
"net:sys:nectar"
|
||||
"eth:distro:sys",
|
||||
"http_server:distro:sys",
|
||||
"net:distro:sys"
|
||||
],
|
||||
"grant_capabilities": [
|
||||
"eth:sys:nectar",
|
||||
"http_server:sys:nectar"
|
||||
"eth:distro:sys",
|
||||
"http_server:distro:sys"
|
||||
],
|
||||
"public": false
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"package": "ndns_indexer",
|
||||
"publisher": "nectar",
|
||||
"publisher": "sys",
|
||||
"version": [
|
||||
0,
|
||||
1,
|
||||
|
@ -5,9 +5,9 @@
|
||||
"on_exit": "Restart",
|
||||
"request_networking": true,
|
||||
"request_capabilities": [
|
||||
"net:sys:nectar",
|
||||
"http_client:sys:nectar",
|
||||
"kernel:sys:nectar"
|
||||
"net:distro:sys",
|
||||
"http_client:distro:sys",
|
||||
"kernel:distro:sys"
|
||||
],
|
||||
"public": true
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"package": "terminal",
|
||||
"publisher": "nectar",
|
||||
"publisher": "sys",
|
||||
"version": [
|
||||
0,
|
||||
1,
|
||||
|
@ -36,7 +36,7 @@ fn parse_command(state: &mut TerminalState, line: &str) -> anyhow::Result<()> {
|
||||
node_id
|
||||
};
|
||||
Request::new()
|
||||
.target((node_id, "net", "sys", "nectar"))
|
||||
.target((node_id, "net", "distro", "sys"))
|
||||
.body(message)
|
||||
.expects_response(5)
|
||||
.send()?;
|
||||
@ -75,7 +75,7 @@ fn parse_command(state: &mut TerminalState, line: &str) -> anyhow::Result<()> {
|
||||
}
|
||||
// send a message to kernel asking it to print debugging information
|
||||
"/top" | "/kernel_debug" => {
|
||||
let kernel_addr = Address::new("our", ("kernel", "sys", "nectar"));
|
||||
let kernel_addr = Address::new("our", ("kernel", "distro", "sys"));
|
||||
match tail {
|
||||
"" => Request::new()
|
||||
.target(kernel_addr)
|
||||
|
@ -5,13 +5,13 @@
|
||||
"on_exit": "Restart",
|
||||
"request_networking": true,
|
||||
"request_capabilities": [
|
||||
"net:sys:nectar",
|
||||
"kernel:sys:nectar",
|
||||
"http_server:sys:nectar",
|
||||
"vfs:sys:nectar"
|
||||
"net:distro:sys",
|
||||
"kernel:distro:sys",
|
||||
"http_server:distro:sys",
|
||||
"vfs:distro:sys"
|
||||
],
|
||||
"grant_capabilities": [
|
||||
"vfs:sys:nectar"
|
||||
"vfs:distro:sys"
|
||||
],
|
||||
"public": true
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"package": "tester",
|
||||
"publisher": "nectar",
|
||||
"publisher": "sys",
|
||||
"version": [
|
||||
0,
|
||||
1,
|
||||
|
@ -1,7 +1,8 @@
|
||||
use std::str::FromStr;
|
||||
|
||||
use nectar_process_lib::{
|
||||
await_message, our_capabilities, println, spawn, vfs, Address, Message, OnExit, ProcessId, Request, Response,
|
||||
await_message, our_capabilities, println, spawn, vfs, Address, Message, OnExit, ProcessId,
|
||||
Request, Response,
|
||||
};
|
||||
|
||||
mod tester_types;
|
||||
@ -18,7 +19,7 @@ wit_bindgen::generate!({
|
||||
fn make_vfs_address(our: &Address) -> anyhow::Result<Address> {
|
||||
Ok(Address::new(
|
||||
our.node.clone(),
|
||||
ProcessId::from_str("vfs:sys:nectar")?,
|
||||
ProcessId::from_str("vfs:distro:sys")?,
|
||||
))
|
||||
}
|
||||
|
||||
@ -37,7 +38,7 @@ fn handle_message(our: &Address) -> anyhow::Result<()> {
|
||||
let response = Request::new()
|
||||
.target(make_vfs_address(&our)?)
|
||||
.body(serde_json::to_vec(&vfs::VfsRequest {
|
||||
path: "/tester:nectar/tests".into(),
|
||||
path: "/tester:sys/tests".into(),
|
||||
action: vfs::VfsAction::ReadDir,
|
||||
})?)
|
||||
.send_and_await_response(test_timeout)?
|
||||
@ -46,7 +47,8 @@ fn handle_message(our: &Address) -> anyhow::Result<()> {
|
||||
let Message::Response { body: vfs_body, .. } = response else {
|
||||
panic!("")
|
||||
};
|
||||
let vfs::VfsResponse::ReadDir(mut children) = serde_json::from_slice(&vfs_body)?
|
||||
let vfs::VfsResponse::ReadDir(mut children) =
|
||||
serde_json::from_slice(&vfs_body)?
|
||||
else {
|
||||
println!(
|
||||
"{:?}",
|
||||
@ -55,9 +57,10 @@ fn handle_message(our: &Address) -> anyhow::Result<()> {
|
||||
panic!("")
|
||||
};
|
||||
|
||||
let caps_file_path = "tester:nectar/tests/grant_capabilities.json";
|
||||
let caps_file_path = "tester:sys/tests/grant_capabilities.json";
|
||||
let caps_index = children.iter().position(|i| *i.path == *caps_file_path);
|
||||
let caps_by_child: std::collections::HashMap<String, Vec<String>> = match caps_index {
|
||||
let caps_by_child: std::collections::HashMap<String, Vec<String>> =
|
||||
match caps_index {
|
||||
None => std::collections::HashMap::new(),
|
||||
Some(caps_index) => {
|
||||
children.remove(caps_index);
|
||||
@ -70,14 +73,19 @@ fn handle_message(our: &Address) -> anyhow::Result<()> {
|
||||
println!("test_runner: running {:?}...", children);
|
||||
|
||||
for child in &children {
|
||||
let grant_caps = child.path
|
||||
let grant_caps = child
|
||||
.path
|
||||
.split("/")
|
||||
.last()
|
||||
.and_then(|child_file_name| child_file_name.strip_suffix(".wasm"))
|
||||
.and_then(|child_file_name| {
|
||||
caps_by_child
|
||||
.get(child_file_name)
|
||||
.and_then(|caps| Some(caps.iter().map(|cap| ProcessId::from_str(cap).unwrap()).collect()))
|
||||
caps_by_child.get(child_file_name).and_then(|caps| {
|
||||
Some(
|
||||
caps.iter()
|
||||
.map(|cap| ProcessId::from_str(cap).unwrap())
|
||||
.collect(),
|
||||
)
|
||||
})
|
||||
})
|
||||
.unwrap_or(vec![]);
|
||||
let child_process_id = match spawn(
|
||||
|
@ -2,8 +2,8 @@ use indexmap::map::IndexMap;
|
||||
|
||||
use nectar_process_lib::kernel_types as kt;
|
||||
use nectar_process_lib::{
|
||||
await_message, call_init, our_capabilities, println, spawn, vfs, Address, Message,
|
||||
OnExit, ProcessId, Request, Response,
|
||||
await_message, call_init, our_capabilities, println, spawn, vfs, Address, Message, OnExit,
|
||||
ProcessId, Request, Response,
|
||||
};
|
||||
|
||||
mod tester_types;
|
||||
@ -22,7 +22,7 @@ type Messages = IndexMap<kt::Message, tt::KernelMessage>;
|
||||
fn make_vfs_address(our: &Address) -> anyhow::Result<Address> {
|
||||
Ok(Address {
|
||||
node: our.node.clone(),
|
||||
process: "vfs:sys:nectar".parse()?,
|
||||
process: "vfs:distro:sys".parse()?,
|
||||
})
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ fn handle_message(
|
||||
match serde_json::from_slice(&body)? {
|
||||
tt::TesterResponse::Pass | tt::TesterResponse::Fail { .. } => {
|
||||
if (source.process.package_name != "tester")
|
||||
| (source.process.publisher_node != "nectar")
|
||||
| (source.process.publisher_node != "sys")
|
||||
{
|
||||
return Err(tt::TesterError::UnexpectedResponse.into());
|
||||
}
|
||||
@ -70,13 +70,13 @@ fn handle_message(
|
||||
.unwrap();
|
||||
} else {
|
||||
// we are master node
|
||||
let child = "/tester:nectar/pkg/test_runner.wasm";
|
||||
let child = "/tester:sys/pkg/test_runner.wasm";
|
||||
let child_process_id = match spawn(
|
||||
None,
|
||||
child,
|
||||
OnExit::None, // TODO: notify us
|
||||
our_capabilities(),
|
||||
vec!["vfs:sys:nectar".parse::<ProcessId>().unwrap()],
|
||||
vec!["vfs:distro:sys".parse::<ProcessId>().unwrap()],
|
||||
false, // not public
|
||||
) {
|
||||
Ok(child_process_id) => child_process_id,
|
||||
@ -114,7 +114,7 @@ fn init(our: Address) {
|
||||
.target(make_vfs_address(&our).unwrap())
|
||||
.body(
|
||||
serde_json::to_vec(&vfs::VfsRequest {
|
||||
path: "/tester:nectar/tests".into(),
|
||||
path: "/tester:sys/tests".into(),
|
||||
action: vfs::VfsAction::CreateDrive,
|
||||
})
|
||||
.unwrap(),
|
||||
@ -126,18 +126,18 @@ fn init(our: Address) {
|
||||
// orchestrate tests using external scripts
|
||||
// -> must give drive cap to rpc
|
||||
let _ = Request::new()
|
||||
.target(("our", "kernel", "sys", "nectar"))
|
||||
.target(("our", "kernel", "distro", "sys"))
|
||||
.body(
|
||||
serde_json::to_vec(&kt::KernelCommand::GrantCapabilities {
|
||||
target: ProcessId::new(Some("http_server"), "sys", "nectar"),
|
||||
target: ProcessId::new(Some("http_server"), "distro", "sys"),
|
||||
capabilities: vec![kt::Capability {
|
||||
issuer: Address::new(
|
||||
our.node.clone(),
|
||||
ProcessId::new(Some("vfs"), "sys", "nectar"),
|
||||
ProcessId::new(Some("vfs"), "distro", "sys"),
|
||||
),
|
||||
params: serde_json::json!({
|
||||
"kind": "write",
|
||||
"drive": "/tester:nectar/tests",
|
||||
"drive": "/tester:sys/tests",
|
||||
})
|
||||
.to_string(),
|
||||
}],
|
||||
|
@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashMap;
|
||||
use tokio::task::JoinHandle;
|
||||
|
||||
/// The Request type that can be made to eth:sys:nectar. Currently primitive, this
|
||||
/// The Request type that can be made to eth:distro:sys. Currently primitive, this
|
||||
/// enum will expand to support more actions in the future.
|
||||
///
|
||||
/// Will be serialized and deserialized using `serde_json::to_vec` and `serde_json::from_slice`.
|
||||
|
@ -142,7 +142,7 @@ pub async fn http_client(
|
||||
id,
|
||||
source: Address {
|
||||
node: our_name.to_string(),
|
||||
process: ProcessId::new(Some("http_client"), "sys", "nectar"),
|
||||
process: ProcessId::new(Some("http_client"), "distro", "sys"),
|
||||
},
|
||||
target: target.clone(),
|
||||
rsvp: None,
|
||||
@ -419,7 +419,7 @@ async fn handle_http_request(
|
||||
id,
|
||||
source: Address {
|
||||
node: our.to_string(),
|
||||
process: ProcessId::new(Some("http_client"), "sys", "nectar"),
|
||||
process: ProcessId::new(Some("http_client"), "distro", "sys"),
|
||||
},
|
||||
target,
|
||||
rsvp: None,
|
||||
@ -520,7 +520,7 @@ async fn http_error_message(
|
||||
id,
|
||||
source: Address {
|
||||
node: our.to_string(),
|
||||
process: ProcessId::new(Some("http_client"), "sys", "nectar"),
|
||||
process: ProcessId::new(Some("http_client"), "distro", "sys"),
|
||||
},
|
||||
target,
|
||||
rsvp: None,
|
||||
@ -617,7 +617,7 @@ async fn handle_ws_message(
|
||||
id,
|
||||
source: Address {
|
||||
node: our.to_string(),
|
||||
process: ProcessId::new(Some("http_client"), "sys", "nectar"),
|
||||
process: ProcessId::new(Some("http_client"), "distro", "sys"),
|
||||
},
|
||||
target,
|
||||
rsvp: None,
|
||||
|
@ -6,7 +6,7 @@ use thiserror::Error;
|
||||
// TODO: add documentation similar to server_types
|
||||
|
||||
/// Request type that can be shared over WASM boundary to apps.
|
||||
/// This is the one you send to the `http_client:sys:nectar` service.
|
||||
/// This is the one you send to the `http_client:distro:sys` service.
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub enum HttpClientAction {
|
||||
Http(OutgoingHttpRequest),
|
||||
@ -25,7 +25,7 @@ pub enum HttpClientAction {
|
||||
}
|
||||
|
||||
/// HTTP Request type that can be shared over WASM boundary to apps.
|
||||
/// This is the one you send to the `http_client:sys:nectar` service.
|
||||
/// This is the one you send to the `http_client:distro:sys` service.
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct OutgoingHttpRequest {
|
||||
pub method: String, // must parse to http::Method
|
||||
@ -37,7 +37,7 @@ pub struct OutgoingHttpRequest {
|
||||
}
|
||||
|
||||
/// WebSocket Client Request type that can be shared over WASM boundary to apps.
|
||||
/// This comes from an open websocket client connection in the `http_client:sys:nectar` service.
|
||||
/// This comes from an open websocket client connection in the `http_client:distro:sys` service.
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub enum HttpClientRequest {
|
||||
WebSocketPush {
|
||||
@ -50,7 +50,7 @@ pub enum HttpClientRequest {
|
||||
}
|
||||
|
||||
/// HTTP Client Response type that can be shared over WASM boundary to apps.
|
||||
/// This is the one you receive from the `http_client:sys:nectar` service.
|
||||
/// This is the one you receive from the `http_client:distro:sys` service.
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub enum HttpClientResponse {
|
||||
Http(HttpResponse),
|
||||
|
@ -86,13 +86,13 @@ pub async fn http_server(
|
||||
// add RPC path
|
||||
let mut bindings_map: Router<BoundPath> = Router::new();
|
||||
let rpc_bound_path = BoundPath {
|
||||
app: ProcessId::new(Some("rpc"), "sys", "nectar"),
|
||||
app: ProcessId::new(Some("rpc"), "distro", "sys"),
|
||||
secure_subdomain: None, // TODO maybe RPC should have subdomain?
|
||||
authenticated: false,
|
||||
local_only: true,
|
||||
static_content: None,
|
||||
};
|
||||
bindings_map.add("/rpc:sys:nectar/message", rpc_bound_path);
|
||||
bindings_map.add("/rpc:distro:sys/message", rpc_bound_path);
|
||||
let path_bindings: PathBindings = Arc::new(RwLock::new(bindings_map));
|
||||
|
||||
// ws path bindings
|
||||
@ -454,10 +454,10 @@ async fn http_handler(
|
||||
}
|
||||
}
|
||||
|
||||
// RPC functionality: if path is /rpc:sys:nectar/message,
|
||||
// RPC functionality: if path is /rpc:distro:sys/message,
|
||||
// we extract message from base64 encoded bytes in data
|
||||
// and send it to the correct app.
|
||||
let message = if bound_path.app == "rpc:sys:nectar" {
|
||||
let message = if bound_path.app == "rpc:distro:sys" {
|
||||
match handle_rpc_message(our, id, body, print_tx).await {
|
||||
Ok(message) => message,
|
||||
Err(e) => {
|
||||
@ -794,7 +794,7 @@ async fn handle_app_message(
|
||||
return;
|
||||
};
|
||||
// if path is /rpc/message, return accordingly with base64 encoded blob
|
||||
if path == "/rpc:sys:nectar/message" {
|
||||
if path == "/rpc:distro:sys/message" {
|
||||
let blob = km.lazy_load_blob.map(|p| LazyLoadBlob {
|
||||
mime: p.mime,
|
||||
bytes: base64::encode(p.bytes).into_bytes(),
|
||||
@ -856,7 +856,7 @@ async fn handle_app_message(
|
||||
cache,
|
||||
} => {
|
||||
let mut path_bindings = path_bindings.write().await;
|
||||
if km.source.process != "homepage:homepage:nectar" {
|
||||
if km.source.process != "homepage:homepage:sys" {
|
||||
path = if path.starts_with('/') {
|
||||
format!("/{}{}", km.source.process, path)
|
||||
} else {
|
||||
|
@ -4,7 +4,7 @@ use std::collections::HashMap;
|
||||
use thiserror::Error;
|
||||
|
||||
/// HTTP Request type that can be shared over WASM boundary to apps.
|
||||
/// This is the one you receive from the `http_server:sys:nectar` service.
|
||||
/// This is the one you receive from the `http_server:distro:sys` service.
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub enum HttpServerRequest {
|
||||
Http(IncomingHttpRequest),
|
||||
@ -52,7 +52,7 @@ pub struct RpcResponseBody {
|
||||
pub lazy_load_blob: Option<LazyLoadBlob>,
|
||||
}
|
||||
|
||||
/// Request type sent to `http_server:sys:nectar` in order to configure it.
|
||||
/// Request type sent to `http_server:distro:sys` in order to configure it.
|
||||
/// You can also send [`type@HttpServerAction::WebSocketPush`], which
|
||||
/// allows you to push messages across an existing open WebSocket connection.
|
||||
///
|
||||
|
@ -191,7 +191,7 @@ async fn handle_kernel_request(
|
||||
let parent_caps: &HashMap<t::Capability, Vec<u8>> =
|
||||
&process_map.get(&km.source.process).unwrap().capabilities;
|
||||
let mut valid_capabilities: HashMap<t::Capability, Vec<u8>> = HashMap::new();
|
||||
if km.source.process == "kernel:sys:nectar" {
|
||||
if km.source.process == "kernel:distro:sys" {
|
||||
for cap in initial_capabilities {
|
||||
let sig = keypair.sign(&rmp_serde::to_vec(&cap).unwrap());
|
||||
valid_capabilities.insert(cap, sig.as_ref().to_vec());
|
||||
@ -619,7 +619,7 @@ async fn start_process(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// the nectar kernel. contains event loop which handles all message-passing between
|
||||
/// the OS kernel. contains event loop which handles all message-passing between
|
||||
/// all processes (WASM apps) and also runtime tasks.
|
||||
pub async fn kernel(
|
||||
our: t::Identity,
|
||||
@ -651,7 +651,7 @@ pub async fn kernel(
|
||||
|
||||
let mut senders: Senders = HashMap::new();
|
||||
senders.insert(
|
||||
t::ProcessId::new(Some("net"), "sys", "nectar"),
|
||||
t::ProcessId::new(Some("net"), "distro", "sys"),
|
||||
ProcessSender::Runtime(send_to_net.clone()),
|
||||
);
|
||||
for (process_id, sender, _) in runtime_extensions {
|
||||
@ -803,7 +803,7 @@ pub async fn kernel(
|
||||
},
|
||||
target: t::Address {
|
||||
node: our.name.clone(),
|
||||
process: t::ProcessId::new(Some("ndns_indexer"), "ndns_indexer", "nectar"),
|
||||
process: t::ProcessId::new(Some("ndns_indexer"), "ndns_indexer", "sys"),
|
||||
},
|
||||
rsvp: None,
|
||||
message: t::Message::Request(t::Request {
|
||||
@ -819,7 +819,7 @@ pub async fn kernel(
|
||||
.expect("fatal: kernel event loop died");
|
||||
|
||||
#[cfg(feature = "simulation-mode")]
|
||||
let tester_process_id = t::ProcessId::new(Some("tester"), "tester", "nectar");
|
||||
let tester_process_id = t::ProcessId::new(Some("tester"), "tester", "sys");
|
||||
|
||||
// main event loop
|
||||
loop {
|
||||
|
18
src/main.rs
18
src/main.rs
@ -329,42 +329,42 @@ async fn main() {
|
||||
#[allow(unused_mut)]
|
||||
let mut runtime_extensions = vec![
|
||||
(
|
||||
ProcessId::new(Some("http_server"), "sys", "nectar"),
|
||||
ProcessId::new(Some("http_server"), "distro", "sys"),
|
||||
http_server_sender,
|
||||
false,
|
||||
),
|
||||
(
|
||||
ProcessId::new(Some("http_client"), "sys", "nectar"),
|
||||
ProcessId::new(Some("http_client"), "distro", "sys"),
|
||||
http_client_sender,
|
||||
false,
|
||||
),
|
||||
(
|
||||
ProcessId::new(Some("timer"), "sys", "nectar"),
|
||||
ProcessId::new(Some("timer"), "distro", "sys"),
|
||||
timer_service_sender,
|
||||
true,
|
||||
),
|
||||
(
|
||||
ProcessId::new(Some("eth"), "sys", "nectar"),
|
||||
ProcessId::new(Some("eth"), "distro", "sys"),
|
||||
eth_provider_sender,
|
||||
false,
|
||||
),
|
||||
(
|
||||
ProcessId::new(Some("vfs"), "sys", "nectar"),
|
||||
ProcessId::new(Some("vfs"), "distro", "sys"),
|
||||
vfs_message_sender,
|
||||
false,
|
||||
),
|
||||
(
|
||||
ProcessId::new(Some("state"), "sys", "nectar"),
|
||||
ProcessId::new(Some("state"), "distro", "sys"),
|
||||
state_sender,
|
||||
false,
|
||||
),
|
||||
(
|
||||
ProcessId::new(Some("kv"), "sys", "nectar"),
|
||||
ProcessId::new(Some("kv"), "distro", "sys"),
|
||||
kv_sender,
|
||||
false,
|
||||
),
|
||||
(
|
||||
ProcessId::new(Some("sqlite"), "sys", "nectar"),
|
||||
ProcessId::new(Some("sqlite"), "distro", "sys"),
|
||||
sqlite_sender,
|
||||
false,
|
||||
),
|
||||
@ -372,7 +372,7 @@ async fn main() {
|
||||
|
||||
/*
|
||||
* the kernel module will handle our userspace processes and receives
|
||||
* all "messages", the basic message format for nectar.
|
||||
* the basic message format for this OS.
|
||||
*
|
||||
* if any of these modules fail, the program exits with an error.
|
||||
*/
|
||||
|
@ -930,7 +930,7 @@ async fn handle_local_message(
|
||||
id: km.id,
|
||||
source: Address {
|
||||
node: our.name.clone(),
|
||||
process: ProcessId::new(Some("net"), "sys", "nectar"),
|
||||
process: ProcessId::new(Some("net"), "distro", "sys"),
|
||||
},
|
||||
target: km.rsvp.unwrap_or(km.source),
|
||||
rsvp: None,
|
||||
|
@ -209,17 +209,17 @@ pub async fn create_passthrough(
|
||||
if !target_peer.routing_for {
|
||||
return Err(anyhow!("we don't route for that indirect node"));
|
||||
}
|
||||
// send their net:sys:nectar process a message, notifying it to create a *matching*
|
||||
// send their net:distro:sys process a message, notifying it to create a *matching*
|
||||
// passthrough request, which we can pair with this pending one.
|
||||
target_peer.sender.send(KernelMessage {
|
||||
id: rand::random(),
|
||||
source: Address {
|
||||
node: our.name.clone(),
|
||||
process: ProcessId::new(Some("net"), "sys", "nectar"),
|
||||
process: ProcessId::new(Some("net"), "distro", "sys"),
|
||||
},
|
||||
target: Address {
|
||||
node: to_name.clone(),
|
||||
process: ProcessId::new(Some("net"), "sys", "nectar"),
|
||||
process: ProcessId::new(Some("net"), "distro", "sys"),
|
||||
},
|
||||
rsvp: None,
|
||||
message: Message::Request(Request {
|
||||
@ -326,7 +326,7 @@ pub async fn recv_protocol_message(conn: &mut PeerConnection) -> Result<KernelMe
|
||||
&mut conn.buf,
|
||||
)?;
|
||||
if outer_len < 4 {
|
||||
return Err(anyhow!("nectar message too small!"));
|
||||
return Err(anyhow!("protocol message too small!"));
|
||||
}
|
||||
|
||||
let length_bytes = [conn.buf[0], conn.buf[1], conn.buf[2], conn.buf[3]];
|
||||
@ -485,7 +485,7 @@ pub async fn parse_hello_message(
|
||||
id: km.id,
|
||||
source: Address {
|
||||
node: our.name.clone(),
|
||||
process: ProcessId::new(Some("net"), "sys", "nectar"),
|
||||
process: ProcessId::new(Some("net"), "distro", "sys"),
|
||||
},
|
||||
target: km.rsvp.as_ref().unwrap_or(&km.source).clone(),
|
||||
rsvp: None,
|
||||
|
@ -299,7 +299,7 @@ async fn bootstrap(
|
||||
let k_cap = Capability {
|
||||
issuer: Address {
|
||||
node: our_name.to_string(),
|
||||
process: ProcessId::new(Some("kernel"), "sys", "nectar"),
|
||||
process: ProcessId::new(Some("kernel"), "distro", "sys"),
|
||||
},
|
||||
params: "\"messaging\"".into(),
|
||||
};
|
||||
@ -308,7 +308,7 @@ async fn bootstrap(
|
||||
let n_cap = Capability {
|
||||
issuer: Address {
|
||||
node: our_name.to_string(),
|
||||
process: ProcessId::new(Some("net"), "sys", "nectar"),
|
||||
process: ProcessId::new(Some("net"), "distro", "sys"),
|
||||
},
|
||||
params: "\"messaging\"".into(),
|
||||
};
|
||||
@ -336,7 +336,7 @@ async fn bootstrap(
|
||||
// finally, save runtime modules in state map as well, somewhat fakely
|
||||
// special cases for kernel and net
|
||||
process_map
|
||||
.entry(ProcessId::new(Some("kernel"), "sys", "nectar"))
|
||||
.entry(ProcessId::new(Some("kernel"), "distro", "sys"))
|
||||
.or_insert(PersistedProcess {
|
||||
wasm_bytes_handle: "".into(),
|
||||
wit_version: None,
|
||||
@ -345,7 +345,7 @@ async fn bootstrap(
|
||||
public: false,
|
||||
});
|
||||
process_map
|
||||
.entry(ProcessId::new(Some("net"), "sys", "nectar"))
|
||||
.entry(ProcessId::new(Some("net"), "distro", "sys"))
|
||||
.or_insert(PersistedProcess {
|
||||
wasm_bytes_handle: "".into(),
|
||||
wit_version: None,
|
||||
|
20
src/types.rs
20
src/types.rs
@ -5,16 +5,16 @@ use std::collections::{HashMap, HashSet};
|
||||
use thiserror::Error;
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref ETH_PROCESS_ID: ProcessId = ProcessId::new(Some("eth"), "sys", "nectar");
|
||||
pub static ref HTTP_CLIENT_PROCESS_ID: ProcessId = ProcessId::new(Some("http_client"), "sys", "nectar");
|
||||
pub static ref HTTP_SERVER_PROCESS_ID: ProcessId = ProcessId::new(Some("http_server"), "sys", "nectar");
|
||||
pub static ref KERNEL_PROCESS_ID: ProcessId = ProcessId::new(Some("kernel"), "sys", "nectar");
|
||||
pub static ref TERMINAL_PROCESS_ID: ProcessId = ProcessId::new(Some("terminal"), "terminal", "nectar");
|
||||
pub static ref TIMER_PROCESS_ID: ProcessId = ProcessId::new(Some("timer"), "sys", "nectar");
|
||||
pub static ref VFS_PROCESS_ID: ProcessId = ProcessId::new(Some("vfs"), "sys", "nectar");
|
||||
pub static ref STATE_PROCESS_ID: ProcessId = ProcessId::new(Some("state"), "sys", "nectar");
|
||||
pub static ref KV_PROCESS_ID: ProcessId = ProcessId::new(Some("kv"), "sys", "nectar");
|
||||
pub static ref SQLITE_PROCESS_ID: ProcessId = ProcessId::new(Some("sqlite"), "sys", "nectar");
|
||||
pub static ref ETH_PROCESS_ID: ProcessId = ProcessId::new(Some("eth"), "distro", "sys");
|
||||
pub static ref HTTP_CLIENT_PROCESS_ID: ProcessId = ProcessId::new(Some("http_client"), "distro", "sys");
|
||||
pub static ref HTTP_SERVER_PROCESS_ID: ProcessId = ProcessId::new(Some("http_server"), "distro", "sys");
|
||||
pub static ref KERNEL_PROCESS_ID: ProcessId = ProcessId::new(Some("kernel"), "distro", "sys");
|
||||
pub static ref TERMINAL_PROCESS_ID: ProcessId = ProcessId::new(Some("terminal"), "terminal", "sys");
|
||||
pub static ref TIMER_PROCESS_ID: ProcessId = ProcessId::new(Some("timer"), "distro", "sys");
|
||||
pub static ref VFS_PROCESS_ID: ProcessId = ProcessId::new(Some("vfs"), "distro", "sys");
|
||||
pub static ref STATE_PROCESS_ID: ProcessId = ProcessId::new(Some("state"), "distro", "sys");
|
||||
pub static ref KV_PROCESS_ID: ProcessId = ProcessId::new(Some("kv"), "distro", "sys");
|
||||
pub static ref SQLITE_PROCESS_ID: ProcessId = ProcessId::new(Some("sqlite"), "distro", "sys");
|
||||
}
|
||||
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user