last bit of cleanup, everything critical working

This commit is contained in:
dr-frmr 2023-11-06 23:03:00 -05:00
parent dcc61e8ad4
commit 2ae22c1e26
No known key found for this signature in database
5 changed files with 10 additions and 31 deletions

View File

@ -153,21 +153,6 @@ fn main() {
let entry_path = entry.unwrap().path(); let entry_path = entry.unwrap().path();
let package_name = entry_path.file_name().unwrap().to_str().unwrap(); let package_name = entry_path.file_name().unwrap().to_str().unwrap();
if ![
"app_store",
"chess",
"homepage",
"http_proxy",
"key_value",
"qns_indexer",
"sqlite",
"terminal",
]
.contains(&package_name)
{
continue;
}
// If Cargo.toml is present, build the app // If Cargo.toml is present, build the app
let parent_pkg_path = format!("{}/pkg", entry_path.display()); let parent_pkg_path = format!("{}/pkg", entry_path.display());
if entry_path.join("Cargo.toml").exists() { if entry_path.join("Cargo.toml").exists() {

View File

@ -4,8 +4,8 @@ use std::collections::{HashMap, HashSet};
use uqbar_process_lib::kernel_types as kt; use uqbar_process_lib::kernel_types as kt;
use uqbar_process_lib::uqbar::process::standard as wit; use uqbar_process_lib::uqbar::process::standard as wit;
use uqbar_process_lib::{ use uqbar_process_lib::{
get_capability, get_payload, get_typed_state, grant_messaging, receive, set_state, Address, get_capability, get_payload, get_typed_state, grant_messaging, println, receive, set_state,
Message, NodeId, PackageId, ProcessId, Request, Response, Address, Message, NodeId, PackageId, ProcessId, Request, Response,
}; };
wit_bindgen::generate!({ wit_bindgen::generate!({
@ -158,15 +158,9 @@ pub enum InstallResponse {
Failure, Failure,
} }
//
// app store init()
//
impl Guest for Component { impl Guest for Component {
fn init(our: String) { fn init(our: String) {
let our = Address::from_str(&our).unwrap(); let our = Address::from_str(&our).unwrap();
assert_eq!(our.process, "main:app_store:uqbar");
// begin by granting messaging capabilities to http_server and terminal, // begin by granting messaging capabilities to http_server and terminal,
// so that they can send us requests. // so that they can send us requests.
grant_messaging( grant_messaging(
@ -176,16 +170,14 @@ impl Guest for Component {
ProcessId::from_str("terminal:terminal:uqbar").unwrap(), ProcessId::from_str("terminal:terminal:uqbar").unwrap(),
]), ]),
); );
println!("app_store main proc: start"); println!("{}: start", our.process);
// load in our saved state or initalize a new one if none exists // load in our saved state or initalize a new one if none exists
let mut state = get_typed_state(|bytes| { let mut state =
Ok(bincode::deserialize(bytes).unwrap_or(State { get_typed_state(|bytes| Ok(bincode::deserialize(bytes)?)).unwrap_or(State {
packages: HashMap::new(), packages: HashMap::new(),
requested_packages: HashSet::new(), requested_packages: HashSet::new(),
})) });
})
.unwrap();
// active the main messaging loop: handle requests and responses // active the main messaging loop: handle requests and responses
loop { loop {

View File

@ -68,6 +68,7 @@ fn main(our: Address) -> anyhow::Result<()> {
// bind to all of our favorite paths // bind to all of our favorite paths
for path in ["/", "/static/*", "/list", "/register", "/serve/:username/*"] { for path in ["/", "/static/*", "/list", "/register", "/serve/:username/*"] {
Request::new() Request::new()
.target(Address::new(&our.node, "http_server:sys:uqbar")?)?
.ipc( .ipc(
&json!({ &json!({
"BindPath": { "BindPath": {
@ -273,6 +274,7 @@ fn main(our: Address) -> anyhow::Result<()> {
} }
Request::new() Request::new()
.target(Address::new(&username, "http_server:sys:uqbar")?)?
.inherit(true) .inherit(true)
.ipc( .ipc(
&json!({ &json!({

View File

@ -104,7 +104,7 @@ fn subscribe_to_qns(from_block: u64) -> Vec<u8> {
} }
fn serialize_message(message: &NetActions) -> anyhow::Result<Vec<u8>> { fn serialize_message(message: &NetActions) -> anyhow::Result<Vec<u8>> {
Ok(serde_json::to_vec(message)?) Ok(rmp_serde::to_vec(message)?)
} }
fn serialize_json_message(message: &serde_json::Value) -> anyhow::Result<Vec<u8>> { fn serialize_json_message(message: &serde_json::Value) -> anyhow::Result<Vec<u8>> {

View File

@ -11,7 +11,7 @@ wit_bindgen::generate!({
}); });
fn serialize_message(message: &&str) -> anyhow::Result<Vec<u8>> { fn serialize_message(message: &&str) -> anyhow::Result<Vec<u8>> {
Ok(serde_json::to_vec(message)?) Ok(message.as_bytes().to_vec())
} }
fn parse_command(our_name: &str, line: &str) -> anyhow::Result<()> { fn parse_command(our_name: &str, line: &str) -> anyhow::Result<()> {