mirror of
https://github.com/uqbar-dao/nectar.git
synced 2025-01-01 13:05:00 +03:00
parent
110b9d19b8
commit
13a7be6b6d
97
modules/sqlite/sqlite/Cargo.lock
generated
97
modules/sqlite/sqlite/Cargo.lock
generated
@ -35,6 +35,12 @@ version = "1.5.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bytes"
|
||||||
|
version = "1.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
@ -47,6 +53,21 @@ version = "1.0.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fnv"
|
||||||
|
version = "1.0.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "form_urlencoded"
|
||||||
|
version = "1.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456"
|
||||||
|
dependencies = [
|
||||||
|
"percent-encoding",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "getrandom"
|
name = "getrandom"
|
||||||
version = "0.2.10"
|
version = "0.2.10"
|
||||||
@ -73,12 +94,33 @@ dependencies = [
|
|||||||
"unicode-segmentation",
|
"unicode-segmentation",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "http"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"fnv",
|
||||||
|
"itoa",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "id-arena"
|
name = "id-arena"
|
||||||
version = "2.2.1"
|
version = "2.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005"
|
checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "idna"
|
||||||
|
version = "0.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-bidi",
|
||||||
|
"unicode-normalization",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "2.0.0"
|
version = "2.0.0"
|
||||||
@ -129,6 +171,12 @@ version = "1.0.14"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
|
checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "percent-encoding"
|
||||||
|
version = "2.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ppv-lite86"
|
name = "ppv-lite86"
|
||||||
version = "0.2.17"
|
version = "0.2.17"
|
||||||
@ -308,12 +356,42 @@ dependencies = [
|
|||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tinyvec"
|
||||||
|
version = "1.6.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50"
|
||||||
|
dependencies = [
|
||||||
|
"tinyvec_macros",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tinyvec_macros"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-bidi"
|
||||||
|
version = "0.3.13"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-ident"
|
name = "unicode-ident"
|
||||||
version = "1.0.11"
|
version = "1.0.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c"
|
checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-normalization"
|
||||||
|
version = "0.1.22"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921"
|
||||||
|
dependencies = [
|
||||||
|
"tinyvec",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-segmentation"
|
name = "unicode-segmentation"
|
||||||
version = "1.10.1"
|
version = "1.10.1"
|
||||||
@ -328,16 +406,31 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "uqbar_process_lib"
|
name = "uqbar_process_lib"
|
||||||
version = "0.2.0"
|
version = "0.3.0"
|
||||||
source = "git+ssh://git@github.com/uqbar-dao/process_lib.git?rev=e53c124#e53c124ec95ef99c06d201d4d08dada8ec691d29"
|
source = "git+ssh://git@github.com/uqbar-dao/process_lib.git?rev=7e4065c#7e4065cfa8c918ad8c41ebd2039509f29f828ec5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bincode",
|
"bincode",
|
||||||
|
"http",
|
||||||
"rand",
|
"rand",
|
||||||
"serde",
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"thiserror",
|
||||||
|
"url",
|
||||||
"wit-bindgen",
|
"wit-bindgen",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "url"
|
||||||
|
version = "2.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633"
|
||||||
|
dependencies = [
|
||||||
|
"form_urlencoded",
|
||||||
|
"idna",
|
||||||
|
"percent-encoding",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasi"
|
name = "wasi"
|
||||||
version = "0.11.0+wasi-snapshot-preview1"
|
version = "0.11.0+wasi-snapshot-preview1"
|
||||||
|
@ -17,7 +17,7 @@ rmp-serde = "1.1"
|
|||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
uqbar_process_lib = { git = "ssh://git@github.com/uqbar-dao/process_lib.git", rev = "e53c124" }
|
uqbar_process_lib = { git = "ssh://git@github.com/uqbar-dao/process_lib.git", rev = "7e4065c" }
|
||||||
wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "5390bab780733f1660d14c254ec985df2816bf1d" }
|
wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "5390bab780733f1660d14c254ec985df2816bf1d" }
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
@ -50,10 +50,10 @@ fn forward_if_have_cap(
|
|||||||
.target(wit::Address {
|
.target(wit::Address {
|
||||||
node: our.node.clone(),
|
node: our.node.clone(),
|
||||||
process: process_id.clone(),
|
process: process_id.clone(),
|
||||||
})?
|
})
|
||||||
// .target(Address::new(our.node.clone(), process_id.clone()))?
|
// .target(Address::new(our.node.clone(), process_id.clone()))?
|
||||||
.inherit(true)
|
.inherit(true)
|
||||||
.ipc_bytes(ipc)
|
.ipc(ipc)
|
||||||
.send()?;
|
.send()?;
|
||||||
return Ok(());
|
return Ok(());
|
||||||
} else {
|
} else {
|
||||||
@ -83,9 +83,8 @@ fn handle_message (
|
|||||||
sq::SqliteMessage::New { ref db } => {
|
sq::SqliteMessage::New { ref db } => {
|
||||||
// TODO: make atomic
|
// TODO: make atomic
|
||||||
// (1): create vfs drive
|
// (1): create vfs drive
|
||||||
// (2): spin up worker, granting vfs caps
|
// (2): spin up worker, granting vfs caps & msg_cap
|
||||||
// (3): issue new caps
|
// (3): issue new caps
|
||||||
// (4): persist
|
|
||||||
|
|
||||||
if db_to_process.contains_key(db) {
|
if db_to_process.contains_key(db) {
|
||||||
return Err(sq::SqliteError::DbAlreadyExists.into());
|
return Err(sq::SqliteError::DbAlreadyExists.into());
|
||||||
@ -94,12 +93,13 @@ fn handle_message (
|
|||||||
// (1)
|
// (1)
|
||||||
let vfs_address = Address {
|
let vfs_address = Address {
|
||||||
node: our.node.clone(),
|
node: our.node.clone(),
|
||||||
process: ProcessId::new("vfs", "sys", "uqbar"),
|
process: ProcessId::new(Some("vfs"), "sys", "uqbar"),
|
||||||
};
|
};
|
||||||
|
|
||||||
let vfs_drive = format!("{}{}", PREFIX, db);
|
let vfs_drive = format!("{}{}", PREFIX, db);
|
||||||
let _ = Request::new()
|
let _ = Request::new()
|
||||||
.target(vfs_address.clone())?
|
.target(vfs_address.clone())
|
||||||
.ipc_bytes(serde_json::to_vec(&kt::VfsRequest {
|
.ipc(serde_json::to_vec(&kt::VfsRequest {
|
||||||
drive: vfs_drive.clone(),
|
drive: vfs_drive.clone(),
|
||||||
action: kt::VfsAction::New,
|
action: kt::VfsAction::New,
|
||||||
})?)
|
})?)
|
||||||
@ -110,15 +110,22 @@ fn handle_message (
|
|||||||
&vfs_address,
|
&vfs_address,
|
||||||
&make_vfs_cap("read", &vfs_drive),
|
&make_vfs_cap("read", &vfs_drive),
|
||||||
).ok_or(anyhow::anyhow!("New failed: no vfs 'read' capability found"))?;
|
).ok_or(anyhow::anyhow!("New failed: no vfs 'read' capability found"))?;
|
||||||
|
|
||||||
let vfs_write = wit::get_capability(
|
let vfs_write = wit::get_capability(
|
||||||
&vfs_address,
|
&vfs_address,
|
||||||
&make_vfs_cap("write", &vfs_drive),
|
&make_vfs_cap("write", &vfs_drive),
|
||||||
).ok_or(anyhow::anyhow!("New failed: no vfs 'write' capability found"))?;
|
).ok_or(anyhow::anyhow!("New failed: no vfs 'write' capability found"))?;
|
||||||
|
|
||||||
|
let msg_cap = wit::get_capability(
|
||||||
|
&source,
|
||||||
|
&"\"messaging\"".into(),
|
||||||
|
).ok_or(anyhow::anyhow!("New failed: no msg capability passed"))?;
|
||||||
|
|
||||||
let spawned_process_id = match wit::spawn(
|
let spawned_process_id = match wit::spawn(
|
||||||
None,
|
None,
|
||||||
"/sqlite_worker.wasm",
|
"/sqlite_worker.wasm",
|
||||||
&wit::OnPanic::None, // TODO: notify us
|
&wit::OnPanic::None,
|
||||||
&wit::Capabilities::Some(vec![vfs_read, vfs_write]),
|
&wit::Capabilities::Some(vec![vfs_read, vfs_write, msg_cap]),
|
||||||
false, // not public
|
false, // not public
|
||||||
) {
|
) {
|
||||||
Ok(spawned_process_id) => spawned_process_id,
|
Ok(spawned_process_id) => spawned_process_id,
|
||||||
@ -135,16 +142,14 @@ fn handle_message (
|
|||||||
.target(wit::Address {
|
.target(wit::Address {
|
||||||
node: our.node.clone(),
|
node: our.node.clone(),
|
||||||
process: spawned_process_id.clone(),
|
process: spawned_process_id.clone(),
|
||||||
})?
|
})
|
||||||
.ipc_bytes(ipc.clone())
|
.ipc(ipc.clone())
|
||||||
.send()?;
|
.send()?;
|
||||||
|
|
||||||
// (4)
|
|
||||||
db_to_process.insert(db.into(), spawned_process_id);
|
db_to_process.insert(db.into(), spawned_process_id);
|
||||||
// TODO: persistence?
|
|
||||||
|
|
||||||
Response::new()
|
Response::new()
|
||||||
.ipc_bytes(ipc)
|
.ipc(ipc)
|
||||||
.send()?;
|
.send()?;
|
||||||
},
|
},
|
||||||
sq::SqliteMessage::Write { ref db, ref statement, ref tx_id } => {
|
sq::SqliteMessage::Write { ref db, ref statement, ref tx_id } => {
|
||||||
@ -185,7 +190,9 @@ impl Guest for Component {
|
|||||||
wit::print_to_terminal(0, "sqlite: begin");
|
wit::print_to_terminal(0, "sqlite: begin");
|
||||||
|
|
||||||
let our = Address::from_str(&our).unwrap();
|
let our = Address::from_str(&our).unwrap();
|
||||||
|
|
||||||
let mut db_to_process: DbToProcess = HashMap::new();
|
let mut db_to_process: DbToProcess = HashMap::new();
|
||||||
|
|
||||||
let read_keywords: HashSet<String> = [
|
let read_keywords: HashSet<String> = [
|
||||||
"ANALYZE",
|
"ANALYZE",
|
||||||
"ATTACH",
|
"ATTACH",
|
||||||
@ -232,7 +239,7 @@ impl Guest for Component {
|
|||||||
).as_str());
|
).as_str());
|
||||||
if let Some(e) = e.downcast_ref::<sq::SqliteError>() {
|
if let Some(e) = e.downcast_ref::<sq::SqliteError>() {
|
||||||
Response::new()
|
Response::new()
|
||||||
.ipc_bytes(serde_json::to_vec(&e).unwrap())
|
.ipc(serde_json::to_vec(&e).unwrap())
|
||||||
.send()
|
.send()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
97
modules/sqlite/sqlite_worker/Cargo.lock
generated
97
modules/sqlite/sqlite_worker/Cargo.lock
generated
@ -58,6 +58,12 @@ version = "1.5.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bytes"
|
||||||
|
version = "1.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.0.83"
|
version = "1.0.83"
|
||||||
@ -91,6 +97,21 @@ version = "0.1.9"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a"
|
checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fnv"
|
||||||
|
version = "1.0.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "form_urlencoded"
|
||||||
|
version = "1.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456"
|
||||||
|
dependencies = [
|
||||||
|
"percent-encoding",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "getrandom"
|
name = "getrandom"
|
||||||
version = "0.2.10"
|
version = "0.2.10"
|
||||||
@ -130,12 +151,33 @@ dependencies = [
|
|||||||
"unicode-segmentation",
|
"unicode-segmentation",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "http"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"fnv",
|
||||||
|
"itoa",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "id-arena"
|
name = "id-arena"
|
||||||
version = "2.2.1"
|
version = "2.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005"
|
checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "idna"
|
||||||
|
version = "0.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-bidi",
|
||||||
|
"unicode-normalization",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "2.0.0"
|
version = "2.0.0"
|
||||||
@ -202,6 +244,12 @@ version = "1.0.14"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
|
checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "percent-encoding"
|
||||||
|
version = "2.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pkg-config"
|
name = "pkg-config"
|
||||||
version = "0.3.27"
|
version = "0.3.27"
|
||||||
@ -402,12 +450,42 @@ dependencies = [
|
|||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tinyvec"
|
||||||
|
version = "1.6.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50"
|
||||||
|
dependencies = [
|
||||||
|
"tinyvec_macros",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tinyvec_macros"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-bidi"
|
||||||
|
version = "0.3.13"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-ident"
|
name = "unicode-ident"
|
||||||
version = "1.0.11"
|
version = "1.0.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c"
|
checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-normalization"
|
||||||
|
version = "0.1.22"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921"
|
||||||
|
dependencies = [
|
||||||
|
"tinyvec",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-segmentation"
|
name = "unicode-segmentation"
|
||||||
version = "1.10.1"
|
version = "1.10.1"
|
||||||
@ -422,16 +500,31 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "uqbar_process_lib"
|
name = "uqbar_process_lib"
|
||||||
version = "0.2.0"
|
version = "0.3.0"
|
||||||
source = "git+ssh://git@github.com/uqbar-dao/process_lib.git?rev=e53c124#e53c124ec95ef99c06d201d4d08dada8ec691d29"
|
source = "git+ssh://git@github.com/uqbar-dao/process_lib.git?rev=7e4065c#7e4065cfa8c918ad8c41ebd2039509f29f828ec5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bincode",
|
"bincode",
|
||||||
|
"http",
|
||||||
"rand",
|
"rand",
|
||||||
"serde",
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"thiserror",
|
||||||
|
"url",
|
||||||
"wit-bindgen",
|
"wit-bindgen",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "url"
|
||||||
|
version = "2.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633"
|
||||||
|
dependencies = [
|
||||||
|
"form_urlencoded",
|
||||||
|
"idna",
|
||||||
|
"percent-encoding",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "vcpkg"
|
name = "vcpkg"
|
||||||
version = "0.2.15"
|
version = "0.2.15"
|
||||||
|
@ -19,7 +19,7 @@ serde = { version = "1.0", features = ["derive"] }
|
|||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
base64 = "0.13"
|
base64 = "0.13"
|
||||||
uqbar_process_lib = { git = "ssh://git@github.com/uqbar-dao/process_lib.git", rev = "e53c124" }
|
uqbar_process_lib = { git = "ssh://git@github.com/uqbar-dao/process_lib.git", rev = "7e4065c" }
|
||||||
wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "5390bab780733f1660d14c254ec985df2816bf1d" }
|
wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "5390bab780733f1660d14c254ec985df2816bf1d" }
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
@ -4,10 +4,9 @@ use std::ffi::CString;
|
|||||||
use rusqlite::{types::FromSql, types::FromSqlError, types::ToSql, types::ValueRef};
|
use rusqlite::{types::FromSql, types::FromSqlError, types::ToSql, types::ValueRef};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use uqbar_process_lib::{Address, ProcessId, Response, grant_messaging};
|
use uqbar_process_lib::{Address, ProcessId, Response, create_capability};
|
||||||
use uqbar_process_lib::uqbar::process::standard as wit;
|
use uqbar_process_lib::uqbar::process::standard as wit;
|
||||||
|
|
||||||
use crate::sqlite_types::Deserializable;
|
|
||||||
|
|
||||||
wit_bindgen::generate!({
|
wit_bindgen::generate!({
|
||||||
path: "../../../wit",
|
path: "../../../wit",
|
||||||
@ -453,7 +452,7 @@ fn handle_message(
|
|||||||
};
|
};
|
||||||
|
|
||||||
Response::new()
|
Response::new()
|
||||||
.ipc_bytes(ipc)
|
.ipc(ipc)
|
||||||
.send()?;
|
.send()?;
|
||||||
},
|
},
|
||||||
sq::SqliteMessage::Commit { ref tx_id, .. } => {
|
sq::SqliteMessage::Commit { ref tx_id, .. } => {
|
||||||
@ -473,7 +472,7 @@ fn handle_message(
|
|||||||
tx.commit()?;
|
tx.commit()?;
|
||||||
|
|
||||||
Response::new()
|
Response::new()
|
||||||
.ipc_bytes(ipc)
|
.ipc(ipc)
|
||||||
.send()?;
|
.send()?;
|
||||||
},
|
},
|
||||||
sq::SqliteMessage::Read { ref query, .. } => {
|
sq::SqliteMessage::Read { ref query, .. } => {
|
||||||
@ -525,7 +524,7 @@ fn handle_message(
|
|||||||
let results_bytes = results.as_bytes().to_vec();
|
let results_bytes = results.as_bytes().to_vec();
|
||||||
|
|
||||||
Response::new()
|
Response::new()
|
||||||
.ipc_bytes(ipc)
|
.ipc(ipc)
|
||||||
.payload(wit::Payload {
|
.payload(wit::Payload {
|
||||||
mime: None,
|
mime: None,
|
||||||
bytes: results_bytes,
|
bytes: results_bytes,
|
||||||
@ -548,9 +547,11 @@ impl Guest for Component {
|
|||||||
let mut conn: Option<rusqlite::Connection> = None;
|
let mut conn: Option<rusqlite::Connection> = None;
|
||||||
let mut txs: HashMap<u64, Vec<(String, Vec<sq::SqlValue>)>> = HashMap::new();
|
let mut txs: HashMap<u64, Vec<(String, Vec<sq::SqlValue>)>> = HashMap::new();
|
||||||
|
|
||||||
grant_messaging(
|
let vfs_address = ProcessId::from_str("vfs:sys:uqbar").unwrap();
|
||||||
&our,
|
|
||||||
&Vec::from([ProcessId::from_str("vfs:sys:uqbar").unwrap()])
|
create_capability(
|
||||||
|
&vfs_address,
|
||||||
|
&"\"messaging\"".into(),
|
||||||
);
|
);
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
@ -564,7 +565,7 @@ impl Guest for Component {
|
|||||||
).as_str());
|
).as_str());
|
||||||
if let Some(e) = e.downcast_ref::<sq::SqliteError>() {
|
if let Some(e) = e.downcast_ref::<sq::SqliteError>() {
|
||||||
Response::new()
|
Response::new()
|
||||||
.ipc_bytes(serde_json::to_vec(&e).unwrap())
|
.ipc(serde_json::to_vec(&e).unwrap())
|
||||||
.send()
|
.send()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user