From 0df97161d6588fb91f204aef3dce892439d93655 Mon Sep 17 00:00:00 2001 From: Arpita-Jaiswal Date: Sun, 22 Dec 2024 20:25:08 +0100 Subject: [PATCH 1/4] Move fastn_ds::wasm::Store to fastn_wasm::Store --- Cargo.lock | 6 + fastn-ds/src/wasm/exports/http/get_request.rs | 8 +- .../src/wasm/exports/http/send_response.rs | 8 +- fastn-ds/src/wasm/exports/pg/batch_execute.rs | 4 +- fastn-ds/src/wasm/exports/pg/connect.rs | 4 +- fastn-ds/src/wasm/exports/pg/execute.rs | 4 +- fastn-ds/src/wasm/exports/pg/query.rs | 4 +- fastn-ds/src/wasm/exports/register.rs | 4 +- .../src/wasm/exports/sqlite/batch_execute.rs | 4 +- fastn-ds/src/wasm/exports/sqlite/connect.rs | 4 +- fastn-ds/src/wasm/exports/sqlite/execute.rs | 4 +- fastn-ds/src/wasm/exports/sqlite/query.rs | 4 +- fastn-ds/src/wasm/mod.rs | 2 +- v0.5/Cargo.lock | 1927 ++++++++++++++++- v0.5/Cargo.toml | 17 + v0.5/fastn-wasm/Cargo.toml | 8 +- v0.5/fastn-wasm/src/lib.rs | 2 + v0.5/fastn-wasm/src/store.rs | 39 + 18 files changed, 1966 insertions(+), 87 deletions(-) create mode 100644 v0.5/fastn-wasm/src/store.rs diff --git a/Cargo.lock b/Cargo.lock index 5343a4d17..d27048dea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1623,12 +1623,18 @@ dependencies = [ name = "fastn-wasm" version = "0.1.0" dependencies = [ + "actix-web", + "async-lock", "chrono", + "deadpool", + "deadpool-postgres", "ft-sys-shared", "http 1.2.0", "magic-crypt", "rand", "reqwest", + "rusqlite", + "scc", "serde", "serde_json", "wasmtime", diff --git a/fastn-ds/src/wasm/exports/http/get_request.rs b/fastn-ds/src/wasm/exports/http/get_request.rs index 2df2cc312..f96d19854 100644 --- a/fastn-ds/src/wasm/exports/http/get_request.rs +++ b/fastn-ds/src/wasm/exports/http/get_request.rs @@ -1,12 +1,6 @@ pub async fn get_request( - mut caller: wasmtime::Caller<'_, fastn_ds::wasm::Store>, + mut caller: wasmtime::Caller<'_, fastn_wasm::Store>, ) -> wasmtime::Result { let req = caller.data().to_http(); fastn_wasm::helpers::send_json(req, &mut caller).await } - -impl fastn_ds::wasm::Store { - pub fn to_http(&self) -> ft_sys_shared::Request { - self.req.clone() - } -} diff --git a/fastn-ds/src/wasm/exports/http/send_response.rs b/fastn-ds/src/wasm/exports/http/send_response.rs index b7a67af83..66188fe29 100644 --- a/fastn-ds/src/wasm/exports/http/send_response.rs +++ b/fastn-ds/src/wasm/exports/http/send_response.rs @@ -1,5 +1,5 @@ pub async fn send_response( - mut caller: wasmtime::Caller<'_, fastn_ds::wasm::Store>, + mut caller: wasmtime::Caller<'_, fastn_wasm::Store>, ptr: i32, len: i32, ) -> wasmtime::Result<()> { @@ -7,9 +7,3 @@ pub async fn send_response( caller.data_mut().store_response(r); Ok(()) } - -impl fastn_ds::wasm::Store { - pub fn store_response(&mut self, r: ft_sys_shared::Request) { - self.response = Some(r); - } -} diff --git a/fastn-ds/src/wasm/exports/pg/batch_execute.rs b/fastn-ds/src/wasm/exports/pg/batch_execute.rs index d44c95fb0..b49d2bc7e 100644 --- a/fastn-ds/src/wasm/exports/pg/batch_execute.rs +++ b/fastn-ds/src/wasm/exports/pg/batch_execute.rs @@ -1,5 +1,5 @@ pub async fn batch_execute( - mut caller: wasmtime::Caller<'_, fastn_ds::wasm::Store>, + mut caller: wasmtime::Caller<'_, fastn_wasm::Store>, conn: i32, ptr: i32, len: i32, @@ -9,7 +9,7 @@ pub async fn batch_execute( fastn_wasm::helpers::send_json(res, &mut caller).await } -impl fastn_ds::wasm::Store { +impl fastn_wasm::Store { pub async fn pg_batch_execute( &mut self, conn: i32, diff --git a/fastn-ds/src/wasm/exports/pg/connect.rs b/fastn-ds/src/wasm/exports/pg/connect.rs index 409943a6d..06728d5d9 100644 --- a/fastn-ds/src/wasm/exports/pg/connect.rs +++ b/fastn-ds/src/wasm/exports/pg/connect.rs @@ -1,5 +1,5 @@ pub async fn connect( - mut caller: wasmtime::Caller<'_, fastn_ds::wasm::Store>, + mut caller: wasmtime::Caller<'_, fastn_wasm::Store>, ptr: i32, len: i32, ) -> wasmtime::Result { @@ -7,7 +7,7 @@ pub async fn connect( caller.data_mut().pg_connect(db_url.as_str()).await } -impl fastn_ds::wasm::Store { +impl fastn_wasm::Store { pub async fn pg_connect(&mut self, db_url: &str) -> wasmtime::Result { let db_url = if db_url == "default" { self.db_url.as_str() diff --git a/fastn-ds/src/wasm/exports/pg/execute.rs b/fastn-ds/src/wasm/exports/pg/execute.rs index eea1ed9f4..f4545f9f3 100644 --- a/fastn-ds/src/wasm/exports/pg/execute.rs +++ b/fastn-ds/src/wasm/exports/pg/execute.rs @@ -1,5 +1,5 @@ pub async fn execute( - mut caller: wasmtime::Caller<'_, fastn_ds::wasm::Store>, + mut caller: wasmtime::Caller<'_, fastn_wasm::Store>, conn: i32, ptr: i32, len: i32, @@ -10,7 +10,7 @@ pub async fn execute( fastn_wasm::helpers::send_json(res, &mut caller).await } -impl fastn_ds::wasm::Store { +impl fastn_wasm::Store { pub async fn pg_execute( &mut self, conn: i32, diff --git a/fastn-ds/src/wasm/exports/pg/query.rs b/fastn-ds/src/wasm/exports/pg/query.rs index 0db2ed8ad..6ccf16b91 100644 --- a/fastn-ds/src/wasm/exports/pg/query.rs +++ b/fastn-ds/src/wasm/exports/pg/query.rs @@ -1,5 +1,5 @@ pub async fn query( - mut caller: wasmtime::Caller<'_, fastn_ds::wasm::Store>, + mut caller: wasmtime::Caller<'_, fastn_wasm::Store>, conn: i32, ptr: i32, len: i32, @@ -108,7 +108,7 @@ impl PgRow { } } -impl fastn_ds::wasm::Store { +impl fastn_wasm::Store { pub async fn pg_query( &mut self, conn: i32, diff --git a/fastn-ds/src/wasm/exports/register.rs b/fastn-ds/src/wasm/exports/register.rs index 900e8af43..612b8e220 100644 --- a/fastn-ds/src/wasm/exports/register.rs +++ b/fastn-ds/src/wasm/exports/register.rs @@ -1,5 +1,5 @@ -impl fastn_ds::wasm::Store { - pub fn register_functions(&self, linker: &mut wasmtime::Linker) { +impl fastn_wasm::Store { + pub fn register_functions(&self, linker: &mut wasmtime::Linker) { // general utility functions fastn_ds::func2!(linker, "env_print", fastn_wasm::env::print); fastn_ds::func0ret!(linker, "env_now", fastn_wasm::env::now); diff --git a/fastn-ds/src/wasm/exports/sqlite/batch_execute.rs b/fastn-ds/src/wasm/exports/sqlite/batch_execute.rs index 819daa4ed..dc835edaa 100644 --- a/fastn-ds/src/wasm/exports/sqlite/batch_execute.rs +++ b/fastn-ds/src/wasm/exports/sqlite/batch_execute.rs @@ -1,7 +1,7 @@ use crate::wasm::exports::sqlite::query::rusqlite_to_diesel; pub async fn batch_execute( - mut caller: wasmtime::Caller<'_, fastn_ds::wasm::Store>, + mut caller: wasmtime::Caller<'_, fastn_wasm::Store>, ptr: i32, len: i32, ) -> wasmtime::Result { @@ -10,7 +10,7 @@ pub async fn batch_execute( fastn_wasm::helpers::send_json(res, &mut caller).await } -impl fastn_ds::wasm::Store { +impl fastn_wasm::Store { pub async fn sqlite_batch_execute( &mut self, q: String, diff --git a/fastn-ds/src/wasm/exports/sqlite/connect.rs b/fastn-ds/src/wasm/exports/sqlite/connect.rs index f4e4c6a90..190df1861 100644 --- a/fastn-ds/src/wasm/exports/sqlite/connect.rs +++ b/fastn-ds/src/wasm/exports/sqlite/connect.rs @@ -1,5 +1,5 @@ pub async fn connect( - mut caller: wasmtime::Caller<'_, fastn_ds::wasm::Store>, + mut caller: wasmtime::Caller<'_, fastn_wasm::Store>, ptr: i32, len: i32, ) -> wasmtime::Result { @@ -8,7 +8,7 @@ pub async fn connect( caller.data_mut().sqlite_connect(db_url.as_str()).await } -impl fastn_ds::wasm::Store { +impl fastn_wasm::Store { pub async fn sqlite_connect(&mut self, db_url: &str) -> wasmtime::Result { let db = rusqlite::Connection::open(if db_url == "default" { self.db_url.as_str() diff --git a/fastn-ds/src/wasm/exports/sqlite/execute.rs b/fastn-ds/src/wasm/exports/sqlite/execute.rs index fad7e5702..5f2a4d45a 100644 --- a/fastn-ds/src/wasm/exports/sqlite/execute.rs +++ b/fastn-ds/src/wasm/exports/sqlite/execute.rs @@ -1,7 +1,7 @@ use crate::wasm::exports::sqlite::query::rusqlite_to_diesel; pub async fn execute( - mut caller: wasmtime::Caller<'_, fastn_ds::wasm::Store>, + mut caller: wasmtime::Caller<'_, fastn_wasm::Store>, ptr: i32, len: i32, ) -> wasmtime::Result { @@ -11,7 +11,7 @@ pub async fn execute( fastn_wasm::helpers::send_json(res, &mut caller).await } -impl fastn_ds::wasm::Store { +impl fastn_wasm::Store { async fn sqlite_execute( &mut self, q: fastn_ds::wasm::exports::sqlite::Query, diff --git a/fastn-ds/src/wasm/exports/sqlite/query.rs b/fastn-ds/src/wasm/exports/sqlite/query.rs index f2ed2cea2..a853fccab 100644 --- a/fastn-ds/src/wasm/exports/sqlite/query.rs +++ b/fastn-ds/src/wasm/exports/sqlite/query.rs @@ -1,7 +1,7 @@ use std::os::raw::c_int; pub async fn query( - mut caller: wasmtime::Caller<'_, fastn_ds::wasm::Store>, + mut caller: wasmtime::Caller<'_, fastn_wasm::Store>, _conn: i32, ptr: i32, len: i32, @@ -73,7 +73,7 @@ struct Field { bytes: Option, } -impl fastn_ds::wasm::Store { +impl fastn_wasm::Store { pub async fn sqlite_query( &mut self, q: Query, diff --git a/fastn-ds/src/wasm/mod.rs b/fastn-ds/src/wasm/mod.rs index 24c18a017..912bcd165 100644 --- a/fastn-ds/src/wasm/mod.rs +++ b/fastn-ds/src/wasm/mod.rs @@ -12,7 +12,7 @@ pub async fn process_http_request( db_url: String, ) -> wasmtime::Result { let path = req.uri.clone(); - let hostn_store = fastn_ds::wasm::Store::new(req, wasm_pg_pools, db_url); + let hostn_store = fastn_wasm::Store::new(req, wasm_pg_pools, db_url); let mut linker = wasmtime::Linker::new(module.engine()); hostn_store.register_functions(&mut linker); let wasm_store = wasmtime::Store::new(module.engine(), hostn_store); diff --git a/v0.5/Cargo.lock b/v0.5/Cargo.lock index 5cfb89e3e..9afc3b130 100644 --- a/v0.5/Cargo.lock +++ b/v0.5/Cargo.lock @@ -2,6 +2,189 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "actix-codec" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f7b0a21988c1bf877cf4759ef5ddaac04c1c9fe808c9142ecb78ba97d97a28a" +dependencies = [ + "bitflags", + "bytes", + "futures-core", + "futures-sink", + "memchr", + "pin-project-lite", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "actix-http" +version = "3.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d48f96fc3003717aeb9856ca3d02a8c7de502667ad76eeacd830b48d2e91fac4" +dependencies = [ + "actix-codec", + "actix-rt", + "actix-service", + "actix-utils", + "ahash", + "base64 0.22.1", + "bitflags", + "brotli", + "bytes", + "bytestring", + "derive_more", + "encoding_rs", + "flate2", + "futures-core", + "h2", + "http 0.2.12", + "httparse", + "httpdate", + "itoa", + "language-tags", + "local-channel", + "mime", + "percent-encoding", + "pin-project-lite", + "rand", + "sha1", + "smallvec", + "tokio", + "tokio-util", + "tracing", + "zstd", +] + +[[package]] +name = "actix-macros" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" +dependencies = [ + "quote", + "syn 2.0.91", +] + +[[package]] +name = "actix-router" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13d324164c51f63867b57e73ba5936ea151b8a41a1d23d1031eeb9f70d0236f8" +dependencies = [ + "bytestring", + "cfg-if", + "http 0.2.12", + "regex", + "regex-lite", + "serde", + "tracing", +] + +[[package]] +name = "actix-rt" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24eda4e2a6e042aa4e55ac438a2ae052d3b5da0ecf83d7411e1a368946925208" +dependencies = [ + "futures-core", + "tokio", +] + +[[package]] +name = "actix-server" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ca2549781d8dd6d75c40cf6b6051260a2cc2f3c62343d761a969a0640646894" +dependencies = [ + "actix-rt", + "actix-service", + "actix-utils", + "futures-core", + "futures-util", + "mio", + "socket2", + "tokio", + "tracing", +] + +[[package]] +name = "actix-service" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b894941f818cfdc7ccc4b9e60fa7e53b5042a2e8567270f9147d5591893373a" +dependencies = [ + "futures-core", + "paste", + "pin-project-lite", +] + +[[package]] +name = "actix-utils" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88a1dcdff1466e3c2488e1cb5c36a71822750ad43839937f85d2f4d9f8b705d8" +dependencies = [ + "local-waker", + "pin-project-lite", +] + +[[package]] +name = "actix-web" +version = "4.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9180d76e5cc7ccbc4d60a506f2c727730b154010262df5b910eb17dbe4b8cb38" +dependencies = [ + "actix-codec", + "actix-http", + "actix-macros", + "actix-router", + "actix-rt", + "actix-server", + "actix-service", + "actix-utils", + "actix-web-codegen", + "ahash", + "bytes", + "bytestring", + "cfg-if", + "cookie", + "derive_more", + "encoding_rs", + "futures-core", + "futures-util", + "impl-more", + "itoa", + "language-tags", + "log", + "mime", + "once_cell", + "pin-project-lite", + "regex", + "regex-lite", + "serde", + "serde_json", + "serde_urlencoded", + "smallvec", + "socket2", + "time", + "url", +] + +[[package]] +name = "actix-web-codegen" +version = "4.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f591380e2e68490b5dfaf1dd1aa0ebe78d84ba7067078512b4ea6e4492d622b8" +dependencies = [ + "actix-router", + "proc-macro2", + "quote", + "syn 2.0.91", +] + [[package]] name = "addr2line" version = "0.24.2" @@ -17,6 +200,17 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -24,6 +218,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", + "getrandom", "once_cell", "version_check", "zerocopy", @@ -38,12 +233,42 @@ dependencies = [ "memchr", ] +[[package]] +name = "alloc-no-stdlib" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" + +[[package]] +name = "alloc-stdlib" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" +dependencies = [ + "alloc-no-stdlib", +] + [[package]] name = "allocator-api2" version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + [[package]] name = "anyhow" version = "1.0.95" @@ -68,6 +293,17 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" +[[package]] +name = "async-lock" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18" +dependencies = [ + "event-listener", + "event-listener-strategy", + "pin-project-lite", +] + [[package]] name = "async-trait" version = "0.1.83" @@ -79,6 +315,12 @@ dependencies = [ "syn 2.0.91", ] +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + [[package]] name = "backtrace" version = "0.3.74" @@ -100,6 +342,12 @@ version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + [[package]] name = "bitflags" version = "2.6.0" @@ -115,6 +363,36 @@ dependencies = [ "generic-array", ] +[[package]] +name = "block-padding" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93" +dependencies = [ + "generic-array", +] + +[[package]] +name = "brotli" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74f7971dbd9326d58187408ab83117d8ac1bb9c17b085fdacd1cf2f598719b6b" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", + "brotli-decompressor", +] + +[[package]] +name = "brotli-decompressor" +version = "4.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a45bd2e4095a8b518033b128020dd4a55aab1c0a381ba4404a472630f4bc362" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", +] + [[package]] name = "bumpalo" version = "3.16.0" @@ -136,6 +414,24 @@ version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b" +[[package]] +name = "bytestring" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e465647ae23b2823b0753f50decb2d5a86d2bb2cac04788fafd1f80e45378e5f" +dependencies = [ + "bytes", +] + +[[package]] +name = "cbc" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6" +dependencies = [ + "cipher", +] + [[package]] name = "cc" version = "1.2.5" @@ -153,12 +449,58 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "chrono" +version = "0.4.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "js-sys", + "num-traits", + "serde", + "wasm-bindgen", + "windows-targets", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + [[package]] name = "cobs" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + [[package]] name = "convert_case" version = "0.6.0" @@ -168,6 +510,17 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "cookie" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb" +dependencies = [ + "percent-encoding", + "time", + "version_check", +] + [[package]] name = "copy_dir" version = "0.1.3" @@ -177,6 +530,12 @@ dependencies = [ "walkdir", ] +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + [[package]] name = "cpp_demangle" version = "0.4.4" @@ -302,6 +661,15 @@ dependencies = [ "target-lexicon", ] +[[package]] +name = "crc-any" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a62ec9ff5f7965e4d7280bd5482acd20aadb50d632cf6c1d74493856b011fa73" +dependencies = [ + "debug-helper", +] + [[package]] name = "crc32fast" version = "1.4.2" @@ -347,53 +715,135 @@ dependencies = [ ] [[package]] -name = "debugid" -version = "0.8.0" +name = "deadpool" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" +checksum = "fb84100978c1c7b37f09ed3ce3e5f843af02c2a2c431bae5b19230dad2c1b490" dependencies = [ - "uuid", + "async-trait", + "deadpool-runtime", + "num_cpus", + "tokio", ] [[package]] -name = "digest" -version = "0.10.7" +name = "deadpool-postgres" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +checksum = "bda39fa1cfff190d8924d447ad04fd22772c250438ca5ce1dfb3c80621c05aaa" dependencies = [ - "block-buffer", - "crypto-common", + "deadpool", + "tokio", + "tokio-postgres", + "tracing", ] [[package]] -name = "directories-next" -version = "2.0.0" +name = "deadpool-runtime" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" +checksum = "092966b41edc516079bdf31ec78a2e0588d1d0c08f78b91d8307215928642b2b" dependencies = [ - "cfg-if", - "dirs-sys-next", + "tokio", ] [[package]] -name = "dirs-sys-next" -version = "0.1.2" +name = "debug-helper" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +checksum = "f578e8e2c440e7297e008bb5486a3a8a194775224bbc23729b0dbdfaeebf162e" + +[[package]] +name = "debugid" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" dependencies = [ - "libc", - "redox_users", - "winapi", + "uuid", ] [[package]] -name = "either" -version = "1.13.0" +name = "deranged" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] [[package]] -name = "embedded-io" +name = "derive_more" +version = "0.99.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" +dependencies = [ + "convert_case 0.4.0", + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.91", +] + +[[package]] +name = "des" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdd80ce8ce993de27e9f063a444a4d53ce8e8db4c1f00cc03af5ad5a9867a1e" +dependencies = [ + "cipher", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", +] + +[[package]] +name = "directories-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.91", +] + +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" + +[[package]] +name = "embedded-io" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" @@ -429,12 +879,45 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "event-listener" +version = "5.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6032be9bd27023a771701cc49f9f053c751055f71efb2e0ae5c15809093675ba" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c3e4e0dd3673c1139bf041f3008816d9cf2946bbfac2945c09e523b8d7b05b2" +dependencies = [ + "event-listener", + "pin-project-lite", +] + +[[package]] +name = "fallible-iterator" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" + [[package]] name = "fallible-iterator" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" +[[package]] +name = "fallible-streaming-iterator" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" + [[package]] name = "fastn" version = "0.1.0" @@ -576,11 +1059,33 @@ version = "0.1.0" name = "fastn-wasm" version = "0.1.0" dependencies = [ + "actix-web", + "async-lock", + "chrono", + "deadpool", + "deadpool-postgres", + "ft-sys-shared", + "http 1.2.0", + "magic-crypt", + "rand", + "reqwest", + "rusqlite", + "scc", "serde", "serde_json", "wasmtime", ] +[[package]] +name = "flate2" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + [[package]] name = "fnv" version = "1.0.7" @@ -593,6 +1098,28 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f" +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "ft-sys-shared" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5b532b534b1d9ac90e67a134ff546747fc1754b52891603f100a565acd9a889" +dependencies = [ + "bytes", + "chrono", + "http 1.2.0", + "serde", + "thiserror 1.0.69", +] + [[package]] name = "futures-channel" version = "0.3.31" @@ -600,6 +1127,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", + "futures-sink", ] [[package]] @@ -608,6 +1136,23 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.91", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + [[package]] name = "futures-task" version = "0.3.31" @@ -621,9 +1166,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-core", + "futures-macro", + "futures-sink", "futures-task", "pin-project-lite", "pin-utils", + "slab", ] [[package]] @@ -665,8 +1213,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi", + "wasm-bindgen", ] [[package]] @@ -675,11 +1225,30 @@ version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" dependencies = [ - "fallible-iterator", + "fallible-iterator 0.3.0", "indexmap", "stable_deref_trait", ] +[[package]] +name = "h2" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 0.2.12", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "hashbrown" version = "0.14.5" @@ -699,12 +1268,47 @@ dependencies = [ "serde", ] +[[package]] +name = "hashlink" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" +dependencies = [ + "hashbrown 0.14.5", +] + [[package]] name = "heck" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "http" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "http" version = "1.2.0" @@ -723,7 +1327,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", - "http", + "http 1.2.0", ] [[package]] @@ -734,7 +1338,7 @@ checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", "futures-util", - "http", + "http 1.2.0", "http-body", "pin-project-lite", ] @@ -760,7 +1364,7 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "http", + "http 1.2.0", "http-body", "httparse", "httpdate", @@ -768,6 +1372,25 @@ dependencies = [ "pin-project-lite", "smallvec", "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d191583f3da1305256f22463b9bb0471acad48a4e534a5218b9963e9c1f59b2" +dependencies = [ + "futures-util", + "http 1.2.0", + "hyper", + "hyper-util", + "rustls", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", + "webpki-roots", ] [[package]] @@ -777,12 +1400,157 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" dependencies = [ "bytes", + "futures-channel", "futures-util", - "http", + "http 1.2.0", "http-body", "hyper", "pin-project-lite", + "socket2", "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.91", ] [[package]] @@ -797,6 +1565,33 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" +[[package]] +name = "idna" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "impl-more" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aae21c3177a27788957044151cc2800043d127acaa460a47ebb9b84dfa2c6aa0" + [[package]] name = "indexmap" version = "2.7.0" @@ -814,6 +1609,22 @@ version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "block-padding", + "generic-array", +] + +[[package]] +name = "ipnet" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" + [[package]] name = "itertools" version = "0.12.1" @@ -867,6 +1678,22 @@ dependencies = [ "libc", ] +[[package]] +name = "js-sys" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "language-tags" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388" + [[package]] name = "leb128" version = "0.2.5" @@ -905,12 +1732,56 @@ dependencies = [ "libc", ] +[[package]] +name = "libsqlite3-sys" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c10584274047cb335c23d3e61bcef8e323adae7c5c8c760540f73610177fc3f" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + [[package]] name = "linux-raw-sys" version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +[[package]] +name = "litemap" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" + +[[package]] +name = "local-channel" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6cbc85e69b8df4b8bb8b89ec634e7189099cea8927a276b7384ce5488e53ec8" +dependencies = [ + "futures-core", + "futures-sink", + "local-waker", +] + +[[package]] +name = "local-waker" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d873d7c67ce09b42110d801813efbc9364414e356be9935700d368351657487" + +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + [[package]] name = "log" version = "0.4.22" @@ -926,6 +1797,32 @@ dependencies = [ "libc", ] +[[package]] +name = "magic-crypt" +version = "4.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "844b6169eeaae32ae8a61855964331a67f12d2afba9170303fbd3e3c2a861a52" +dependencies = [ + "aes", + "base64 0.22.1", + "cbc", + "crc-any", + "des", + "md-5", + "sha2", + "tiger", +] + +[[package]] +name = "md-5" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +dependencies = [ + "cfg-if", + "digest", +] + [[package]] name = "memchr" version = "2.7.4" @@ -941,6 +1838,12 @@ dependencies = [ "rustix", ] +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + [[package]] name = "miniz_oxide" version = "0.8.2" @@ -957,10 +1860,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" dependencies = [ "libc", + "log", "wasi", "windows-sys 0.52.0", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + [[package]] name = "object" version = "0.36.7" @@ -979,12 +1908,65 @@ version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + +[[package]] +name = "parking_lot" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets", +] + [[package]] name = "paste" version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "phf" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +dependencies = [ + "phf_shared", +] + +[[package]] +name = "phf_shared" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project-lite" version = "0.2.15" @@ -992,27 +1974,71 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" [[package]] -name = "pin-utils" -version = "0.1.0" +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" + +[[package]] +name = "postcard" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" +dependencies = [ + "cobs", + "embedded-io 0.4.0", + "embedded-io 0.6.1", + "serde", +] + +[[package]] +name = "postgres-protocol" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acda0ebdebc28befa84bee35e651e4c5f09073d668c7aed4cf7e23c3cda84b23" +dependencies = [ + "base64 0.22.1", + "byteorder", + "bytes", + "fallible-iterator 0.2.0", + "hmac", + "md-5", + "memchr", + "rand", + "sha2", + "stringprep", +] + +[[package]] +name = "postgres-types" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +checksum = "f66ea23a2d0e5734297357705193335e0a957696f34bed2f2faefacb2fec336f" +dependencies = [ + "bytes", + "fallible-iterator 0.2.0", + "postgres-protocol", +] [[package]] -name = "pkg-config" -version = "0.3.31" +name = "powerfmt" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] -name = "postcard" -version = "1.1.1" +name = "ppv-lite86" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" dependencies = [ - "cobs", - "embedded-io 0.4.0", - "embedded-io 0.6.1", - "serde", + "zerocopy", ] [[package]] @@ -1111,6 +2137,58 @@ dependencies = [ "once_cell", ] +[[package]] +name = "quinn" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62e96808277ec6f97351a2380e6c25114bc9e67037775464979f3037c92d05ef" +dependencies = [ + "bytes", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2", + "thiserror 2.0.9", + "tokio", + "tracing", +] + +[[package]] +name = "quinn-proto" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2fe5ef3495d7d2e377ff17b1a8ce2ee2ec2a18cde8b6ad6619d65d0701c135d" +dependencies = [ + "bytes", + "getrandom", + "rand", + "ring", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "thiserror 2.0.9", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c40286217b4ba3a71d644d752e6a0b71f13f1b6a2c5311acfcbe0c2418ed904" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.59.0", +] + [[package]] name = "quote" version = "1.0.37" @@ -1120,6 +2198,36 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + [[package]] name = "rayon" version = "1.10.0" @@ -1140,6 +2248,15 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "redox_syscall" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" +dependencies = [ + "bitflags", +] + [[package]] name = "redox_users" version = "0.4.6" @@ -1188,6 +2305,12 @@ dependencies = [ "regex-syntax", ] +[[package]] +name = "regex-lite" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53a49587ad06b26609c52e423de037e7f57f20d53535d66e08c695f347df952a" + [[package]] name = "regex-syntax" version = "0.8.5" @@ -1200,6 +2323,48 @@ version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba39f3699c378cd8970968dcbff9c43159ea4cfbd88d43c00b22f2ef10a435d2" +[[package]] +name = "reqwest" +version = "0.12.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-core", + "futures-util", + "http 1.2.0", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "ipnet", + "js-sys", + "log", + "mime", + "once_cell", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pemfile", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", + "windows-registry", +] + [[package]] name = "ress" version = "0.9.1" @@ -1210,6 +2375,21 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "ring" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +dependencies = [ + "cc", + "cfg-if", + "getrandom", + "libc", + "spin", + "untrusted", + "windows-sys 0.52.0", +] + [[package]] name = "rquickjs" version = "0.6.2" @@ -1236,7 +2416,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7d2ecaf7c9eda262e02a91e9541989a9dd18984d17d0d97f99f33b464318057" dependencies = [ - "convert_case", + "convert_case 0.6.0", "fnv", "ident_case", "indexmap", @@ -1257,6 +2437,20 @@ dependencies = [ "cc", ] +[[package]] +name = "rusqlite" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b838eba278d213a8beaf485bd313fd580ca4505a00d5871caeb1457c55322cae" +dependencies = [ + "bitflags", + "fallible-iterator 0.3.0", + "fallible-streaming-iterator", + "hashlink", + "libsqlite3-sys", + "smallvec", +] + [[package]] name = "rustc-demangle" version = "0.1.24" @@ -1269,6 +2463,15 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + [[package]] name = "rustix" version = "0.38.42" @@ -1282,6 +2485,49 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "rustls" +version = "0.23.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5065c3f250cbd332cd894be57c40fa52387247659b14a2d6041d121547903b1b" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pemfile" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2bf47e6ff922db3825eb750c4e2ff784c6ff8fb9e13046ef6a1d1c5401b0b37" +dependencies = [ + "web-time", +] + +[[package]] +name = "rustls-webpki" +version = "0.102.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + [[package]] name = "ryu" version = "1.0.18" @@ -1297,6 +2543,27 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "scc" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94b13f8ea6177672c49d12ed964cca44836f59621981b04a3e26b87e675181de" +dependencies = [ + "sdd", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "sdd" +version = "3.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "478f121bb72bbf63c52c93011ea1791dca40140dfe13f8336c4c5ac952c33aa9" + [[package]] name = "semver" version = "1.0.24" @@ -1347,6 +2614,29 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha2" version = "0.10.8" @@ -1364,6 +2654,30 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "signal-hook-registry" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" +dependencies = [ + "libc", +] + +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + [[package]] name = "smallvec" version = "1.13.2" @@ -1383,6 +2697,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + [[package]] name = "sptr" version = "0.3.2" @@ -1405,6 +2725,23 @@ dependencies = [ "serde", ] +[[package]] +name = "stringprep" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1" +dependencies = [ + "unicode-bidi", + "unicode-normalization", + "unicode-properties", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "1.0.109" @@ -1426,6 +2763,26 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.91", +] + [[package]] name = "target-lexicon" version = "0.12.16" @@ -1465,22 +2822,87 @@ version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.91", + "proc-macro2", + "quote", + "syn 2.0.91", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b50fa271071aae2e6ee85f842e2e28ba8cd2c5fb67f11fcb1fd70b276f9e7d4" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.91", +] + +[[package]] +name = "tiger" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "579abbce4ad73b04386dbeb34369c9873a8f9b749c7b99cbf479a2949ff715ed" +dependencies = [ + "digest", +] + +[[package]] +name = "time" +version = "0.3.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", ] [[package]] -name = "thiserror-impl" -version = "2.0.9" +name = "tinyvec" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b50fa271071aae2e6ee85f842e2e28ba8cd2c5fb67f11fcb1fd70b276f9e7d4" +checksum = "022db8904dfa342efe721985167e9fcd16c29b226db4397ed752a761cfce81e8" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.91", + "tinyvec_macros", ] +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + [[package]] name = "tokio" version = "1.42.0" @@ -1488,9 +2910,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551" dependencies = [ "backtrace", + "bytes", "libc", "mio", + "parking_lot", "pin-project-lite", + "signal-hook-registry", "socket2", "tokio-macros", "windows-sys 0.52.0", @@ -1507,6 +2932,55 @@ dependencies = [ "syn 2.0.91", ] +[[package]] +name = "tokio-postgres" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b5d3742945bc7d7f210693b0c58ae542c6fd47b17adbbda0885f3dcb34a6bdb" +dependencies = [ + "async-trait", + "byteorder", + "bytes", + "fallible-iterator 0.2.0", + "futures-channel", + "futures-util", + "log", + "parking_lot", + "percent-encoding", + "phf", + "pin-project-lite", + "postgres-protocol", + "postgres-types", + "rand", + "socket2", + "tokio", + "tokio-util", + "whoami", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6d0975eaace0cf0fcadee4e4aaa5da15b5c079146f2cffb67c113be122bf37" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + [[package]] name = "toml" version = "0.8.19" @@ -1552,6 +3026,50 @@ dependencies = [ "winnow 0.6.20", ] +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.91", +] + +[[package]] +name = "tracing-core" +version = "0.1.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + [[package]] name = "typed-arena" version = "2.0.2" @@ -1564,12 +3082,33 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "unicode-bidi" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" + [[package]] name = "unicode-ident" version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" +[[package]] +name = "unicode-normalization" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-properties" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" + [[package]] name = "unicode-segmentation" version = "1.12.0" @@ -1594,12 +3133,47 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "uuid" version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.5" @@ -1616,12 +3190,94 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" + +[[package]] +name = "wasm-bindgen" +version = "0.2.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" +dependencies = [ + "cfg-if", + "once_cell", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" +dependencies = [ + "bumpalo", + "log", + "proc-macro2", + "quote", + "syn 2.0.91", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38176d9b44ea84e9184eff0bc34cc167ed044f816accfe5922e54d84cf48eca2" +dependencies = [ + "cfg-if", + "js-sys", + "once_cell", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.91", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" + [[package]] name = "wasm-encoder" version = "0.221.2" @@ -1750,7 +3406,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "368d974999abe6095341da9b9e2c0908a6272e796001e06b7022ad60b2d19710" dependencies = [ "anyhow", - "base64", + "base64 0.21.7", "directories-next", "log", "postcard", @@ -1942,6 +3598,46 @@ dependencies = [ "wast", ] +[[package]] +name = "web-sys" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04dd7223427d52553d3702c004d3b2fe07c148165faa56313cb00211e31c12bc" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "0.26.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d642ff16b7e79272ae451b7322067cdc17cadf68c23264be9d94a32319efe7e" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "whoami" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "372d5b87f58ec45c384ba03563b03544dc5fadc3983e434b286913f5b4a9bb6d" +dependencies = [ + "redox_syscall", + "wasite", + "web-sys", +] + [[package]] name = "winapi" version = "0.3.9" @@ -1990,6 +3686,45 @@ dependencies = [ "wasmtime-environ", ] +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-registry" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +dependencies = [ + "windows-result", + "windows-strings", + "windows-targets", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result", + "windows-targets", +] + [[package]] name = "windows-sys" version = "0.52.0" @@ -2108,12 +3843,49 @@ dependencies = [ "wasmparser 0.221.2", ] +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + +[[package]] +name = "yoke" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.91", + "synstructure", +] + [[package]] name = "zerocopy" version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ + "byteorder", "zerocopy-derive", ] @@ -2128,6 +3900,55 @@ dependencies = [ "syn 2.0.91", ] +[[package]] +name = "zerofrom" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.91", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" + +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.91", +] + [[package]] name = "zstd" version = "0.13.2" diff --git a/v0.5/Cargo.toml b/v0.5/Cargo.toml index ae3c4d2be..232ee5c4e 100644 --- a/v0.5/Cargo.toml +++ b/v0.5/Cargo.toml @@ -40,8 +40,12 @@ homepage = "https://fastn.com" # and create its own [dependencies.] section. Also, document it with why are you not # using the latest dependency, and what is the plan to move to the latest version. +actix-web = "4" arcstr = "1" async-trait = "0.1" +async-lock = "3" +deadpool = "0.10" +deadpool-postgres = "0.12" fastn-builtins = { path = "../fastn-builtins" } fastn-compiler = { path = "fastn-compiler" } fastn-continuation = { path = "fastn-continuation" } @@ -60,6 +64,7 @@ id-arena = "2" indexmap = "2" rand = "0.8" reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] } +scc = "2" serde = { version = "1", features = ["derive"] } serde_json = "1" string-interner = "0.18" @@ -68,3 +73,15 @@ wasmtime = "28" chrono = { version = "0.4", features = ["serde"] } magic-crypt = { version = "4", default-features = false } +[workspace.dependencies.rusqlite] +version = "0.31" +features = [ + # We are using the bundled version of rusqlite, so we do not need sqlitelib, headers as a + # dependency. By default, if we do not bundle, our binary will link against system + # provided sqlite, which would have been a good thing, if we used system sqlite, our + # binary size would be smaller, compile time lesser, but unfortunately we can not assume + # sqlite dynamic library is installed on everyone's machine. We can choose to give two + # binaries, one with bundled, one without, but it is not worth the tradeoff right now. + "bundled", + "column_decltype", +] diff --git a/v0.5/fastn-wasm/Cargo.toml b/v0.5/fastn-wasm/Cargo.toml index 25ac59335..b1491c0f9 100644 --- a/v0.5/fastn-wasm/Cargo.toml +++ b/v0.5/fastn-wasm/Cargo.toml @@ -9,6 +9,10 @@ repository.workspace = true homepage.workspace = true [dependencies] +async-lock.workspace = true +actix-web.workspace = true +deadpool.workspace = true +deadpool-postgres.workspace = true wasmtime.workspace = true serde_json.workspace = true serde.workspace = true @@ -16,5 +20,7 @@ ft-sys-shared.workspace = true rand.workspace = true http.workspace = true reqwest.workspace = true +rusqlite.workspace = true chrono.workspace = true -magic-crypt.workspace = true \ No newline at end of file +magic-crypt.workspace = true +scc.workspace = true diff --git a/v0.5/fastn-wasm/src/lib.rs b/v0.5/fastn-wasm/src/lib.rs index 6707079e3..27f0a3019 100644 --- a/v0.5/fastn-wasm/src/lib.rs +++ b/v0.5/fastn-wasm/src/lib.rs @@ -10,5 +10,7 @@ pub mod ds; pub mod env; pub mod helpers; pub mod send_request; +mod store; pub use send_request::send_request; +pub use store::Store; diff --git a/v0.5/fastn-wasm/src/store.rs b/v0.5/fastn-wasm/src/store.rs new file mode 100644 index 000000000..5de004e12 --- /dev/null +++ b/v0.5/fastn-wasm/src/store.rs @@ -0,0 +1,39 @@ +pub struct Store { + pub req: ft_sys_shared::Request, + pub clients: std::sync::Arc>>, + pub pg_pools: actix_web::web::Data>, + pub sqlite: Option>>, + pub response: Option, + pub db_url: String, +} + +pub struct Conn { + pub client: deadpool::managed::Object, +} + +impl Store { + pub fn new( + req: ft_sys_shared::Request, + pg_pools: actix_web::web::Data>, + db_url: String, + ) -> Store { + Self { + req, + response: None, + clients: Default::default(), + pg_pools, + db_url, + sqlite: None, + } + } +} + +impl Store { + pub fn to_http(&self) -> ft_sys_shared::Request { + self.req.clone() + } + + pub fn store_response(&mut self, r: ft_sys_shared::Request) { + self.response = Some(r); + } +} From 43d657565482a13a10c9097919a0b46a2049568f Mon Sep 17 00:00:00 2001 From: Arpita-Jaiswal Date: Sun, 22 Dec 2024 20:28:42 +0100 Subject: [PATCH 2/4] Remove fastn_ds::wasm::Store --- fastn-ds/src/wasm/exports/pg/connect.rs | 4 ++-- fastn-ds/src/wasm/mod.rs | 3 --- fastn-ds/src/wasm/store.rs | 29 ------------------------- v0.5/fastn-wasm/src/lib.rs | 2 +- 4 files changed, 3 insertions(+), 35 deletions(-) delete mode 100644 fastn-ds/src/wasm/store.rs diff --git a/fastn-ds/src/wasm/exports/pg/connect.rs b/fastn-ds/src/wasm/exports/pg/connect.rs index 06728d5d9..6c9d8f9fd 100644 --- a/fastn-ds/src/wasm/exports/pg/connect.rs +++ b/fastn-ds/src/wasm/exports/pg/connect.rs @@ -28,10 +28,10 @@ impl fastn_wasm::Store { async fn get_client( pool: &deadpool_postgres::Pool, - clients: &mut Vec, + clients: &mut Vec, ) -> wasmtime::Result { let client = pool.get().await?; - clients.push(fastn_ds::wasm::Conn { client }); + clients.push(fastn_wasm::Conn { client }); Ok(clients.len() as i32 - 1) } } diff --git a/fastn-ds/src/wasm/mod.rs b/fastn-ds/src/wasm/mod.rs index 912bcd165..f297013e9 100644 --- a/fastn-ds/src/wasm/mod.rs +++ b/fastn-ds/src/wasm/mod.rs @@ -1,8 +1,5 @@ pub mod exports; pub mod macros; -mod store; - -pub use store::{Conn, Store}; #[tracing::instrument(skip_all)] pub async fn process_http_request( diff --git a/fastn-ds/src/wasm/store.rs b/fastn-ds/src/wasm/store.rs deleted file mode 100644 index 78908401d..000000000 --- a/fastn-ds/src/wasm/store.rs +++ /dev/null @@ -1,29 +0,0 @@ -pub struct Store { - pub req: ft_sys_shared::Request, - pub clients: std::sync::Arc>>, - pub pg_pools: actix_web::web::Data>, - pub sqlite: Option>>, - pub response: Option, - pub db_url: String, -} - -pub struct Conn { - pub client: deadpool::managed::Object, -} - -impl Store { - pub fn new( - req: ft_sys_shared::Request, - pg_pools: actix_web::web::Data>, - db_url: String, - ) -> Store { - Self { - req, - response: None, - clients: Default::default(), - pg_pools, - db_url, - sqlite: None, - } - } -} diff --git a/v0.5/fastn-wasm/src/lib.rs b/v0.5/fastn-wasm/src/lib.rs index 27f0a3019..7502d1a9b 100644 --- a/v0.5/fastn-wasm/src/lib.rs +++ b/v0.5/fastn-wasm/src/lib.rs @@ -13,4 +13,4 @@ pub mod send_request; mod store; pub use send_request::send_request; -pub use store::Store; +pub use store::{Conn, Store}; From 0c809d49d9540b857b76e64f8966ef85af5e3cdb Mon Sep 17 00:00:00 2001 From: Arpita-Jaiswal Date: Sun, 22 Dec 2024 20:35:39 +0100 Subject: [PATCH 3/4] Move fastn_ds::wasm::exports::http to fastn_wasm::http --- fastn-ds/src/wasm/exports/mod.rs | 1 - fastn-ds/src/wasm/exports/register.rs | 10 +++------- .../fastn-wasm/src}/http/get_request.rs | 6 ++++++ .../wasm/exports => v0.5/fastn-wasm/src}/http/mod.rs | 2 ++ v0.5/fastn-wasm/src/{ => http}/send_request.rs | 0 .../fastn-wasm/src}/http/send_response.rs | 6 ++++++ v0.5/fastn-wasm/src/lib.rs | 3 +-- v0.5/fastn-wasm/src/store.rs | 10 ---------- 8 files changed, 18 insertions(+), 20 deletions(-) rename {fastn-ds/src/wasm/exports => v0.5/fastn-wasm/src}/http/get_request.rs (65%) rename {fastn-ds/src/wasm/exports => v0.5/fastn-wasm/src}/http/mod.rs (65%) rename v0.5/fastn-wasm/src/{ => http}/send_request.rs (100%) rename {fastn-ds/src/wasm/exports => v0.5/fastn-wasm/src}/http/send_response.rs (66%) diff --git a/fastn-ds/src/wasm/exports/mod.rs b/fastn-ds/src/wasm/exports/mod.rs index 65c449417..e5717b96e 100644 --- a/fastn-ds/src/wasm/exports/mod.rs +++ b/fastn-ds/src/wasm/exports/mod.rs @@ -1,4 +1,3 @@ -mod http; mod pg; mod register; mod sqlite; diff --git a/fastn-ds/src/wasm/exports/register.rs b/fastn-ds/src/wasm/exports/register.rs index 612b8e220..d012c385d 100644 --- a/fastn-ds/src/wasm/exports/register.rs +++ b/fastn-ds/src/wasm/exports/register.rs @@ -44,16 +44,12 @@ impl fastn_wasm::Store { ); // request related stuff - fastn_ds::func0ret!( - linker, - "http_get_request", - fastn_ds::wasm::exports::http::get_request - ); - fastn_ds::func2ret!(linker, "http_send_request", fastn_wasm::send_request); + fastn_ds::func0ret!(linker, "http_get_request", fastn_wasm::http::get_request); + fastn_ds::func2ret!(linker, "http_send_request", fastn_wasm::http::send_request); fastn_ds::func2!( linker, "http_send_response", - fastn_ds::wasm::exports::http::send_response + fastn_wasm::http::send_response ); // document store related diff --git a/fastn-ds/src/wasm/exports/http/get_request.rs b/v0.5/fastn-wasm/src/http/get_request.rs similarity index 65% rename from fastn-ds/src/wasm/exports/http/get_request.rs rename to v0.5/fastn-wasm/src/http/get_request.rs index f96d19854..e061cfc45 100644 --- a/fastn-ds/src/wasm/exports/http/get_request.rs +++ b/v0.5/fastn-wasm/src/http/get_request.rs @@ -4,3 +4,9 @@ pub async fn get_request( let req = caller.data().to_http(); fastn_wasm::helpers::send_json(req, &mut caller).await } + +impl fastn_wasm::Store { + pub fn to_http(&self) -> ft_sys_shared::Request { + self.req.clone() + } +} diff --git a/fastn-ds/src/wasm/exports/http/mod.rs b/v0.5/fastn-wasm/src/http/mod.rs similarity index 65% rename from fastn-ds/src/wasm/exports/http/mod.rs rename to v0.5/fastn-wasm/src/http/mod.rs index 2ca8ede8d..c87ec5bd8 100644 --- a/fastn-ds/src/wasm/exports/http/mod.rs +++ b/v0.5/fastn-wasm/src/http/mod.rs @@ -1,5 +1,7 @@ mod get_request; +pub mod send_request; mod send_response; pub use get_request::get_request; +pub use send_request::send_request; pub use send_response::send_response; diff --git a/v0.5/fastn-wasm/src/send_request.rs b/v0.5/fastn-wasm/src/http/send_request.rs similarity index 100% rename from v0.5/fastn-wasm/src/send_request.rs rename to v0.5/fastn-wasm/src/http/send_request.rs diff --git a/fastn-ds/src/wasm/exports/http/send_response.rs b/v0.5/fastn-wasm/src/http/send_response.rs similarity index 66% rename from fastn-ds/src/wasm/exports/http/send_response.rs rename to v0.5/fastn-wasm/src/http/send_response.rs index 66188fe29..a78d3a99c 100644 --- a/fastn-ds/src/wasm/exports/http/send_response.rs +++ b/v0.5/fastn-wasm/src/http/send_response.rs @@ -7,3 +7,9 @@ pub async fn send_response( caller.data_mut().store_response(r); Ok(()) } + +impl fastn_wasm::Store { + pub fn store_response(&mut self, r: ft_sys_shared::Request) { + self.response = Some(r); + } +} diff --git a/v0.5/fastn-wasm/src/lib.rs b/v0.5/fastn-wasm/src/lib.rs index 7502d1a9b..0fc04c5ab 100644 --- a/v0.5/fastn-wasm/src/lib.rs +++ b/v0.5/fastn-wasm/src/lib.rs @@ -9,8 +9,7 @@ pub mod crypto; pub mod ds; pub mod env; pub mod helpers; -pub mod send_request; +pub mod http; mod store; -pub use send_request::send_request; pub use store::{Conn, Store}; diff --git a/v0.5/fastn-wasm/src/store.rs b/v0.5/fastn-wasm/src/store.rs index 5de004e12..78908401d 100644 --- a/v0.5/fastn-wasm/src/store.rs +++ b/v0.5/fastn-wasm/src/store.rs @@ -27,13 +27,3 @@ impl Store { } } } - -impl Store { - pub fn to_http(&self) -> ft_sys_shared::Request { - self.req.clone() - } - - pub fn store_response(&mut self, r: ft_sys_shared::Request) { - self.response = Some(r); - } -} From 959f3d46885899f2f33d837ebc52d1558de49040 Mon Sep 17 00:00:00 2001 From: Arpita-Jaiswal Date: Tue, 24 Dec 2024 21:58:32 +0100 Subject: [PATCH 4/4] Took step ahead in moving Store, I hope --- fastn-ds/src/wasm/exports/register.rs | 10 +++------- fastn-ds/src/wasm/exports/sqlite/connect.rs | 12 +----------- fastn-ds/src/wasm/exports/sqlite/mod.rs | 1 - fastn-ds/src/wasm/mod.rs | 4 +++- v0.5/fastn-wasm/src/http/get_request.rs | 6 +++--- v0.5/fastn-wasm/src/http/send_response.rs | 6 +++--- v0.5/fastn-wasm/src/lib.rs | 3 ++- v0.5/fastn-wasm/src/sqlite/connect.rs | 12 ++++++++++++ v0.5/fastn-wasm/src/sqlite/mod.rs | 2 ++ v0.5/fastn-wasm/src/store.rs | 17 ++++++++++++++--- 10 files changed, 43 insertions(+), 30 deletions(-) create mode 100644 v0.5/fastn-wasm/src/sqlite/connect.rs create mode 100644 v0.5/fastn-wasm/src/sqlite/mod.rs diff --git a/fastn-ds/src/wasm/exports/register.rs b/fastn-ds/src/wasm/exports/register.rs index d012c385d..7cd0e156a 100644 --- a/fastn-ds/src/wasm/exports/register.rs +++ b/fastn-ds/src/wasm/exports/register.rs @@ -1,5 +1,5 @@ -impl fastn_wasm::Store { - pub fn register_functions(&self, linker: &mut wasmtime::Linker) { +impl fastn_wasm::Store { + pub fn register_functions(&self, linker: &mut wasmtime::Linker>) { // general utility functions fastn_ds::func2!(linker, "env_print", fastn_wasm::env::print); fastn_ds::func0ret!(linker, "env_now", fastn_wasm::env::now); @@ -11,11 +11,7 @@ impl fastn_wasm::Store { fastn_ds::func2ret!(linker, "crypto_decrypt", fastn_wasm::crypto::decrypt); // sqlite - fastn_ds::func2ret!( - linker, - "sqlite_connect", - fastn_ds::wasm::exports::sqlite::connect - ); + fastn_ds::func2ret!(linker, "sqlite_connect", fastn_wasm::sqlite::connect); fastn_ds::func3ret!( linker, "sqlite_query", diff --git a/fastn-ds/src/wasm/exports/sqlite/connect.rs b/fastn-ds/src/wasm/exports/sqlite/connect.rs index 190df1861..b0efbd1e3 100644 --- a/fastn-ds/src/wasm/exports/sqlite/connect.rs +++ b/fastn-ds/src/wasm/exports/sqlite/connect.rs @@ -1,15 +1,5 @@ -pub async fn connect( - mut caller: wasmtime::Caller<'_, fastn_wasm::Store>, - ptr: i32, - len: i32, -) -> wasmtime::Result { - let db_url = fastn_wasm::helpers::get_str(ptr, len, &mut caller)?; - println!("sqlite_connect: {db_url}"); - caller.data_mut().sqlite_connect(db_url.as_str()).await -} - impl fastn_wasm::Store { - pub async fn sqlite_connect(&mut self, db_url: &str) -> wasmtime::Result { + fn sqlite_connect(&mut self, db_url: &str) -> wasmtime::Result { let db = rusqlite::Connection::open(if db_url == "default" { self.db_url.as_str() } else { diff --git a/fastn-ds/src/wasm/exports/sqlite/mod.rs b/fastn-ds/src/wasm/exports/sqlite/mod.rs index dd7751ad7..1d911ba4e 100644 --- a/fastn-ds/src/wasm/exports/sqlite/mod.rs +++ b/fastn-ds/src/wasm/exports/sqlite/mod.rs @@ -1,5 +1,4 @@ mod connect; -pub use connect::connect; mod query; pub use query::query; diff --git a/fastn-ds/src/wasm/mod.rs b/fastn-ds/src/wasm/mod.rs index f297013e9..bc497fdea 100644 --- a/fastn-ds/src/wasm/mod.rs +++ b/fastn-ds/src/wasm/mod.rs @@ -1,6 +1,8 @@ pub mod exports; pub mod macros; +pub struct Store; + #[tracing::instrument(skip_all)] pub async fn process_http_request( req: ft_sys_shared::Request, @@ -9,7 +11,7 @@ pub async fn process_http_request( db_url: String, ) -> wasmtime::Result { let path = req.uri.clone(); - let hostn_store = fastn_wasm::Store::new(req, wasm_pg_pools, db_url); + let hostn_store = fastn_wasm::Store::new(req, wasm_pg_pools, db_url, Store); let mut linker = wasmtime::Linker::new(module.engine()); hostn_store.register_functions(&mut linker); let wasm_store = wasmtime::Store::new(module.engine(), hostn_store); diff --git a/v0.5/fastn-wasm/src/http/get_request.rs b/v0.5/fastn-wasm/src/http/get_request.rs index e061cfc45..d899bfa13 100644 --- a/v0.5/fastn-wasm/src/http/get_request.rs +++ b/v0.5/fastn-wasm/src/http/get_request.rs @@ -1,11 +1,11 @@ -pub async fn get_request( - mut caller: wasmtime::Caller<'_, fastn_wasm::Store>, +pub async fn get_request( + mut caller: wasmtime::Caller<'_, fastn_wasm::Store>, ) -> wasmtime::Result { let req = caller.data().to_http(); fastn_wasm::helpers::send_json(req, &mut caller).await } -impl fastn_wasm::Store { +impl fastn_wasm::Store { pub fn to_http(&self) -> ft_sys_shared::Request { self.req.clone() } diff --git a/v0.5/fastn-wasm/src/http/send_response.rs b/v0.5/fastn-wasm/src/http/send_response.rs index a78d3a99c..38ff80fa5 100644 --- a/v0.5/fastn-wasm/src/http/send_response.rs +++ b/v0.5/fastn-wasm/src/http/send_response.rs @@ -1,5 +1,5 @@ -pub async fn send_response( - mut caller: wasmtime::Caller<'_, fastn_wasm::Store>, +pub async fn send_response( + mut caller: wasmtime::Caller<'_, fastn_wasm::Store>, ptr: i32, len: i32, ) -> wasmtime::Result<()> { @@ -8,7 +8,7 @@ pub async fn send_response( Ok(()) } -impl fastn_wasm::Store { +impl fastn_wasm::Store { pub fn store_response(&mut self, r: ft_sys_shared::Request) { self.response = Some(r); } diff --git a/v0.5/fastn-wasm/src/lib.rs b/v0.5/fastn-wasm/src/lib.rs index 0fc04c5ab..6d28253d1 100644 --- a/v0.5/fastn-wasm/src/lib.rs +++ b/v0.5/fastn-wasm/src/lib.rs @@ -10,6 +10,7 @@ pub mod ds; pub mod env; pub mod helpers; pub mod http; +pub mod sqlite; mod store; -pub use store::{Conn, Store}; +pub use store::{Conn, Store, StoreExt}; diff --git a/v0.5/fastn-wasm/src/sqlite/connect.rs b/v0.5/fastn-wasm/src/sqlite/connect.rs new file mode 100644 index 000000000..8cc47269e --- /dev/null +++ b/v0.5/fastn-wasm/src/sqlite/connect.rs @@ -0,0 +1,12 @@ +pub async fn connect( + mut caller: wasmtime::Caller<'_, fastn_wasm::Store>, + ptr: i32, + len: i32, +) -> wasmtime::Result { + let db_url = fastn_wasm::helpers::get_str(ptr, len, &mut caller)?; + println!("sqlite_connect: {db_url}"); + let store = caller.data_mut(); + // fastn_wasm::StoreExt::sqlite_connect(store, db_url.as_str()).await + store.inner.clone().sqlite_connect(store, db_url.as_str()) + // store.inner.sqlite_connect(store, db_url.as_str()) +} diff --git a/v0.5/fastn-wasm/src/sqlite/mod.rs b/v0.5/fastn-wasm/src/sqlite/mod.rs new file mode 100644 index 000000000..c0532d232 --- /dev/null +++ b/v0.5/fastn-wasm/src/sqlite/mod.rs @@ -0,0 +1,2 @@ +mod connect; +pub use connect::connect; diff --git a/v0.5/fastn-wasm/src/store.rs b/v0.5/fastn-wasm/src/store.rs index 78908401d..7ebe5307c 100644 --- a/v0.5/fastn-wasm/src/store.rs +++ b/v0.5/fastn-wasm/src/store.rs @@ -1,22 +1,32 @@ -pub struct Store { +pub struct Store { pub req: ft_sys_shared::Request, pub clients: std::sync::Arc>>, pub pg_pools: actix_web::web::Data>, pub sqlite: Option>>, pub response: Option, pub db_url: String, + pub inner: T, +} + +pub trait StoreExt: Send + Clone { + fn sqlite_connect( + &self, + store: &mut Store, + db_url: &str, + ) -> wasmtime::Result; } pub struct Conn { pub client: deadpool::managed::Object, } -impl Store { +impl Store { pub fn new( req: ft_sys_shared::Request, pg_pools: actix_web::web::Data>, db_url: String, - ) -> Store { + inner: T, + ) -> Store { Self { req, response: None, @@ -24,6 +34,7 @@ impl Store { pg_pools, db_url, sqlite: None, + inner, } } }