diff --git a/.circleci/config.yml b/.circleci/config.yml index 5ea7be39..d964c8da 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -35,7 +35,7 @@ jobs: cd ../records/ ./build.sh - cd ../site-storage/ + cd ../url-downloader/ ./build.sh cd ../../fluence-faas/tests/wasm_tests/ diff --git a/.gitignore b/.gitignore index ec1d6d87..6845f1f3 100644 --- a/.gitignore +++ b/.gitignore @@ -17,8 +17,8 @@ target/ !/examples/greeting/artifacts/*.wasm !/examples/ipfs-node/artifacts/*.wasm !/examples/records/artifacts/*.wasm -!/examples/site-storage/artifacts/*.wasm !/examples/sqlite/artifacts/sqlite_test.wasm +!/examples/url-downloader/artifacts/*.wasm # Allowed Wasm files for test !/fluence-faas/tests/wasm_tests/arguments_passing/artifacts/*.wasm diff --git a/Cargo.lock b/Cargo.lock index 53af5767..ce6c2f26 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -730,15 +730,6 @@ dependencies = [ "serde_json", ] -[[package]] -name = "fluence" -version = "0.2.9" -source = "git+https://github.com/fluencelabs/rust-sdk#fd9672636e8d7a91275e5e0b8b88a34494336e5a" -dependencies = [ - "fluence-sdk-macro 0.2.9 (git+https://github.com/fluencelabs/rust-sdk)", - "fluence-sdk-main 0.2.9 (git+https://github.com/fluencelabs/rust-sdk)", -] - [[package]] name = "fluence" version = "0.2.9" @@ -749,6 +740,15 @@ dependencies = [ "fluence-sdk-main 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "fluence" +version = "0.2.9" +source = "git+https://github.com/fluencelabs/rust-sdk#fd9672636e8d7a91275e5e0b8b88a34494336e5a" +dependencies = [ + "fluence-sdk-macro 0.2.9 (git+https://github.com/fluencelabs/rust-sdk)", + "fluence-sdk-main 0.2.9 (git+https://github.com/fluencelabs/rust-sdk)", +] + [[package]] name = "fluence-app-service" version = "0.1.12" @@ -787,14 +787,6 @@ dependencies = [ "wasmer-wasi-fl", ] -[[package]] -name = "fluence-sdk-macro" -version = "0.2.9" -source = "git+https://github.com/fluencelabs/rust-sdk#fd9672636e8d7a91275e5e0b8b88a34494336e5a" -dependencies = [ - "fluence-sdk-wit 0.2.9 (git+https://github.com/fluencelabs/rust-sdk)", -] - [[package]] name = "fluence-sdk-macro" version = "0.2.9" @@ -805,13 +797,11 @@ dependencies = [ ] [[package]] -name = "fluence-sdk-main" +name = "fluence-sdk-macro" version = "0.2.9" source = "git+https://github.com/fluencelabs/rust-sdk#fd9672636e8d7a91275e5e0b8b88a34494336e5a" dependencies = [ - "fluence-sdk-macro 0.2.9 (git+https://github.com/fluencelabs/rust-sdk)", - "log", - "serde", + "fluence-sdk-wit 0.2.9 (git+https://github.com/fluencelabs/rust-sdk)", ] [[package]] @@ -826,9 +816,20 @@ dependencies = [ ] [[package]] -name = "fluence-sdk-wit" +name = "fluence-sdk-main" version = "0.2.9" source = "git+https://github.com/fluencelabs/rust-sdk#fd9672636e8d7a91275e5e0b8b88a34494336e5a" +dependencies = [ + "fluence-sdk-macro 0.2.9 (git+https://github.com/fluencelabs/rust-sdk)", + "log", + "serde", +] + +[[package]] +name = "fluence-sdk-wit" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9c68c4d07e821e1be23b01c278acdae4e825d03c46879f453426ea3160b3e25" dependencies = [ "proc-macro2", "quote", @@ -841,8 +842,7 @@ dependencies = [ [[package]] name = "fluence-sdk-wit" version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9c68c4d07e821e1be23b01c278acdae4e825d03c46879f453426ea3160b3e25" +source = "git+https://github.com/fluencelabs/rust-sdk#fd9672636e8d7a91275e5e0b8b88a34494336e5a" dependencies = [ "proc-macro2", "quote", @@ -1278,9 +1278,9 @@ checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" [[package]] name = "js-sys" -version = "0.3.45" +version = "0.3.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca059e81d9486668f12d455a4ea6daa600bd408134cd17e3d3fb5a32d1f016f8" +checksum = "cf3d7383929f7c9c7c2d0fa596f325832df98c3704f2c60553080f7127a58175" dependencies = [ "wasm-bindgen", ] @@ -2687,11 +2687,11 @@ checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" [[package]] name = "wasm-bindgen" -version = "0.2.68" +version = "0.2.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42" +checksum = "3cd364751395ca0f68cafb17666eee36b63077fb5ecd972bbcd74c90c4bf736e" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "serde", "serde_json", "wasm-bindgen-macro", @@ -2699,9 +2699,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.68" +version = "0.2.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68" +checksum = "1114f89ab1f4106e5b55e688b828c0ab0ea593a1ea7c094b141b14cbaaec2d62" dependencies = [ "bumpalo", "lazy_static", @@ -2714,11 +2714,11 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.18" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7866cab0aa01de1edf8b5d7936938a7e397ee50ce24119aef3e1eaa3b6171da" +checksum = "1fe9756085a84584ee9457a002b7cdfe0bfff169f45d2591d8be1345a6780e35" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "js-sys", "wasm-bindgen", "web-sys", @@ -2726,9 +2726,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.68" +version = "0.2.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038" +checksum = "7a6ac8995ead1f084a8dea1e65f194d0973800c7f571f6edd70adf06ecf77084" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2736,9 +2736,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.68" +version = "0.2.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe" +checksum = "b5a48c72f299d80557c7c62e37e7225369ecc0c963964059509fbafe917c7549" dependencies = [ "proc-macro2", "quote", @@ -2749,15 +2749,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.68" +version = "0.2.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307" +checksum = "7e7811dd7f9398f14cc76efd356f98f03aa30419dea46aa810d71e819fc97158" [[package]] name = "wasm-bindgen-test" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34d1cdc8b98a557f24733d50a1199c4b0635e465eecba9c45b214544da197f64" +checksum = "0355fa0c1f9b792a09b6dcb6a8be24d51e71e6d74972f9eb4a44c4c004d24a25" dependencies = [ "console_error_panic_hook", "js-sys", @@ -2769,9 +2769,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-test-macro" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8fb9c67be7439ee8ab1b7db502a49c05e51e2835b66796c705134d9b8e1a585" +checksum = "27e07b46b98024c2ba2f9e83a10c2ef0515f057f2da299c1762a2017de80438b" dependencies = [ "proc-macro2", "quote", @@ -2985,9 +2985,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.45" +version = "0.3.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bf6ef87ad7ae8008e15a355ce696bed26012b7caa21605188cfd8214ab51e2d" +checksum = "222b1ef9334f92a21d3fb53dc3fd80f30836959a90f9274a626d7e06315ba3c3" dependencies = [ "js-sys", "wasm-bindgen", diff --git a/examples/url-downloader/artifacts/curl.wasm b/examples/url-downloader/artifacts/curl.wasm new file mode 100755 index 00000000..ac80b04f Binary files /dev/null and b/examples/url-downloader/artifacts/curl.wasm differ diff --git a/examples/url-downloader/artifacts/facade.wasm b/examples/url-downloader/artifacts/facade.wasm new file mode 100755 index 00000000..e285e94b Binary files /dev/null and b/examples/url-downloader/artifacts/facade.wasm differ diff --git a/examples/url-downloader/artifacts/local_storage.wasm b/examples/url-downloader/artifacts/local_storage.wasm new file mode 100755 index 00000000..b9c8d205 Binary files /dev/null and b/examples/url-downloader/artifacts/local_storage.wasm differ diff --git a/examples/url-downloader/curl/src/main.rs b/examples/url-downloader/curl/src/main.rs index e79973f3..76731328 100644 --- a/examples/url-downloader/curl/src/main.rs +++ b/examples/url-downloader/curl/src/main.rs @@ -26,10 +26,10 @@ pub fn main() { } #[fce] -pub fn get(cmd: String) -> String { - log::info!("get called with url {}", cmd); +pub fn download(url: String) -> String { + log::info!("get called with url {}", url); - unsafe { curl(cmd) } + unsafe { curl(url) } } /// Permissions in `Config.toml` should exist to use host functions. diff --git a/examples/url-downloader/facade/src/main.rs b/examples/url-downloader/facade/src/main.rs index 785ade52..f0fd278c 100644 --- a/examples/url-downloader/facade/src/main.rs +++ b/examples/url-downloader/facade/src/main.rs @@ -28,7 +28,7 @@ pub fn main() { /// Calls `curl` and stores returned result into a file. #[fce] fn get_n_save(url: String, file_name: String) -> String { - let result = unsafe { curl(url) }; + let result = unsafe { download(url) }; unsafe { file_put(file_name, result.into_bytes()) }; String::from("Ok") @@ -38,8 +38,7 @@ fn get_n_save(url: String, file_name: String) -> String { #[fce] #[link(wasm_import_module = "curl")] extern "C" { - #[link_name = "get"] - pub fn curl(url: String) -> String; + pub fn download(url: String) -> String; } /// Importing `local_storage` module