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 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
let parent_pkg_path = format!("{}/pkg", entry_path.display());
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::uqbar::process::standard as wit;
use uqbar_process_lib::{
get_capability, get_payload, get_typed_state, grant_messaging, receive, set_state, Address,
Message, NodeId, PackageId, ProcessId, Request, Response,
get_capability, get_payload, get_typed_state, grant_messaging, println, receive, set_state,
Address, Message, NodeId, PackageId, ProcessId, Request, Response,
};
wit_bindgen::generate!({
@ -158,15 +158,9 @@ pub enum InstallResponse {
Failure,
}
//
// app store init()
//
impl Guest for Component {
fn init(our: String) {
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,
// so that they can send us requests.
grant_messaging(
@ -176,16 +170,14 @@ impl Guest for Component {
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
let mut state = get_typed_state(|bytes| {
Ok(bincode::deserialize(bytes).unwrap_or(State {
let mut state =
get_typed_state(|bytes| Ok(bincode::deserialize(bytes)?)).unwrap_or(State {
packages: HashMap::new(),
requested_packages: HashSet::new(),
}))
})
.unwrap();
});
// active the main messaging loop: handle requests and responses
loop {

View File

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