diff --git a/Cargo.lock b/Cargo.lock index f1c3cd5d..ff982dac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15,15 +15,6 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" -[[package]] -name = "aho-corasick" -version = "0.7.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86" -dependencies = [ - "memchr", -] - [[package]] name = "ansi_term" version = "0.11.0" @@ -357,33 +348,12 @@ dependencies = [ "winapi", ] -[[package]] -name = "effector" -version = "0.1.0" -dependencies = [ - "fluence", - "test-record", -] - [[package]] name = "either" version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" -[[package]] -name = "env_logger" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" -dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", -] - [[package]] name = "erased-serde" version = "0.3.12" @@ -672,14 +642,6 @@ version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724" -[[package]] -name = "greeting" -version = "0.1.0" -dependencies = [ - "anyhow", - "fluence-faas", -] - [[package]] name = "hashbrown" version = "0.8.1" @@ -713,15 +675,6 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35" -[[package]] -name = "humantime" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" -dependencies = [ - "quick-error", -] - [[package]] name = "id-arena" version = "2.2.1" @@ -762,12 +715,18 @@ dependencies = [ ] [[package]] -name = "ipfs_node" +name = "ipfs-effector" version = "0.1.0" dependencies = [ - "anyhow", - "env_logger", - "fluence-app-service", + "fluence", + "log", +] + +[[package]] +name = "ipfs-pure" +version = "0.1.0" +dependencies = [ + "fluence", "log", ] @@ -989,14 +948,6 @@ dependencies = [ "unicode-xid", ] -[[package]] -name = "pure" -version = "0.1.0" -dependencies = [ - "fluence", - "test-record", -] - [[package]] name = "pwasm-utils" version = "0.12.0" @@ -1008,12 +959,6 @@ dependencies = [ "parity-wasm", ] -[[package]] -name = "quick-error" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" - [[package]] name = "quote" version = "1.0.7" @@ -1101,13 +1046,19 @@ dependencies = [ ] [[package]] -name = "records" +name = "record-effector" version = "0.1.0" dependencies = [ - "anyhow", - "env_logger", - "fluence-faas", - "log", + "fluence", + "test-record", +] + +[[package]] +name = "record-pure" +version = "0.1.0" +dependencies = [ + "fluence", + "test-record", ] [[package]] @@ -1127,24 +1078,6 @@ dependencies = [ "rust-argon2", ] -[[package]] -name = "regex" -version = "1.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", - "thread_local", -] - -[[package]] -name = "regex-syntax" -version = "0.6.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" - [[package]] name = "rust-argon2" version = "0.7.0" @@ -1333,15 +1266,6 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab0e7238dcc7b40a7be719a25365910f6807bd864f4cce6b2e6b873658e2b19d" -[[package]] -name = "termcolor" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f" -dependencies = [ - "winapi-util", -] - [[package]] name = "test-record" version = "0.1.0" @@ -1378,15 +1302,6 @@ dependencies = [ "syn", ] -[[package]] -name = "thread_local" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" -dependencies = [ - "lazy_static", -] - [[package]] name = "time" version = "0.1.43" @@ -1520,28 +1435,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] -name = "wasm_greeting" +name = "wasm-greeting" version = "0.1.0" dependencies = [ "fluence", ] -[[package]] -name = "wasm_ipfs_node" -version = "0.1.0" -dependencies = [ - "fluence", - "log", -] - -[[package]] -name = "wasm_ipfs_rpc" -version = "0.1.0" -dependencies = [ - "fluence", - "log", -] - [[package]] name = "wasmer-clif-backend-fl" version = "0.17.0" @@ -1748,15 +1647,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" diff --git a/Cargo.toml b/Cargo.toml index 3d8bc2ca..6cac8ed0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,14 +5,11 @@ members = [ "crates/wit-parser", "engine", "examples/greeting", - "examples/greeting/wasm/", - "examples/ipfs_node", - "examples/ipfs_node/wasm/ipfs_node", - "examples/ipfs_node/wasm/ipfs_rpc", - "examples/records", - "examples/records/wasm/effector", - "examples/records/wasm/pure", - "examples/records/wasm/test-record", + "examples/ipfs-node/effector", + "examples/ipfs-node/pure", + "examples/records/effector", + "examples/records/pure", + "examples/records/test-record", "fluence-app-service", "fluence-faas", "tools/cli", diff --git a/examples/greeting/Cargo.toml b/examples/greeting/Cargo.toml index e4a6ce8b..8f7b7b3c 100644 --- a/examples/greeting/Cargo.toml +++ b/examples/greeting/Cargo.toml @@ -1,9 +1,12 @@ [package] -name = "greeting" +name = "wasm-greeting" version = "0.1.0" authors = ["Fluence Labs"] edition = "2018" +[[bin]] +name = "greeting" +path = "src/main.rs" + [dependencies] -fluence-faas = { path = "../../fluence-faas" } -anyhow = "1.0.31" +fluence = { git = "https://github.com/fluencelabs/rust-sdk" } diff --git a/examples/greeting/Config.toml b/examples/greeting/Config.toml index 8f13a036..dd40fadd 100644 --- a/examples/greeting/Config.toml +++ b/examples/greeting/Config.toml @@ -1,6 +1,6 @@ -core_modules_dir = "wasm/artifacts/" +modules_dir = "artifacts/" -[[core_module]] +[[module]] name = "greeting.wasm" mem_pages_count = 1 logger_enabled = false diff --git a/examples/greeting/src/main.rs b/examples/greeting/src/main.rs index 5ade146b..dcf27182 100644 --- a/examples/greeting/src/main.rs +++ b/examples/greeting/src/main.rs @@ -14,27 +14,11 @@ * limitations under the License. */ -use fluence_faas::FluenceFaaS; -use fluence_faas::IValue; +use fluence::fce; -use std::path::PathBuf; +pub fn main() {} -const GREETING_MODULE_CONFIG_PATH: &str = "Config.toml"; - -fn main() -> Result<(), anyhow::Error> { - let mut greeting_node = FluenceFaaS::new(PathBuf::from(GREETING_MODULE_CONFIG_PATH))?; - println!( - "greeting node interface is\n{}", - greeting_node.get_interface() - ); - - let result = greeting_node.call( - "greeting.wasm", - "greeting", - &[IValue::String("Fluence".to_string()), IValue::I32(1)], - )?; - - println!("execution result {:?}", result); - - Ok(()) +#[fce] +pub fn greeting(name: String) -> String { + format!("Hi, {}", name) } diff --git a/examples/greeting/wasm/Cargo.toml b/examples/greeting/wasm/Cargo.toml deleted file mode 100644 index 01d4efc1..00000000 --- a/examples/greeting/wasm/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "wasm_greeting" -version = "0.1.0" -authors = ["Fluence Labs"] -edition = "2018" - -[[bin]] -name = "greeting" -path = "src/main.rs" - -[dependencies] -fluence = { git = "https://github.com/fluencelabs/rust-sdk" } diff --git a/examples/greeting/wasm/artifacts/greeting.wasm b/examples/greeting/wasm/artifacts/greeting.wasm deleted file mode 100755 index 49fea6d0..00000000 Binary files a/examples/greeting/wasm/artifacts/greeting.wasm and /dev/null differ diff --git a/examples/greeting/wasm/src/main.rs b/examples/greeting/wasm/src/main.rs deleted file mode 100644 index dcf27182..00000000 --- a/examples/greeting/wasm/src/main.rs +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2020 Fluence Labs Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -use fluence::fce; - -pub fn main() {} - -#[fce] -pub fn greeting(name: String) -> String { - format!("Hi, {}", name) -} diff --git a/examples/ipfs_node/Config.toml b/examples/ipfs-node/Config.toml similarity index 74% rename from examples/ipfs_node/Config.toml rename to examples/ipfs-node/Config.toml index bfa5410d..cb8b7a5e 100644 --- a/examples/ipfs_node/Config.toml +++ b/examples/ipfs-node/Config.toml @@ -1,5 +1,4 @@ -modules_dir = "wasm/artifacts/wasm_modules" -service_base_dir = "/Users/tmp" +modules_dir = "artifacts/wasm_modules" [[module]] name = "ipfs_node.wasm" @@ -13,6 +12,6 @@ service_base_dir = "/Users/tmp" envs = ["IPFS_ADDR=/dns4/relay02.fluence.dev/tcp/15001", "timeout=1s"] [[module]] - name = "ipfs_rpc.wasm" + name = "ipfs_pure.wasm" mem_pages_count = 100 logger_enabled = true diff --git a/examples/ipfs_node/wasm/artifacts/ipfs_rpc_file b/examples/ipfs-node/artifacts/ipfs_rpc_file similarity index 100% rename from examples/ipfs_node/wasm/artifacts/ipfs_rpc_file rename to examples/ipfs-node/artifacts/ipfs_rpc_file diff --git a/examples/ipfs_node/wasm/ipfs_node/Cargo.toml b/examples/ipfs-node/effector/Cargo.toml similarity index 90% rename from examples/ipfs_node/wasm/ipfs_node/Cargo.toml rename to examples/ipfs-node/effector/Cargo.toml index e26e3d51..c9119230 100644 --- a/examples/ipfs_node/wasm/ipfs_node/Cargo.toml +++ b/examples/ipfs-node/effector/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "wasm_ipfs_node" +name = "ipfs-effector" version = "0.1.0" authors = ["Fluence Labs"] edition = "2018" diff --git a/examples/ipfs_node/wasm/ipfs_node/src/main.rs b/examples/ipfs-node/effector/src/main.rs similarity index 100% rename from examples/ipfs_node/wasm/ipfs_node/src/main.rs rename to examples/ipfs-node/effector/src/main.rs diff --git a/examples/ipfs_node/wasm/ipfs_node/src/path.rs b/examples/ipfs-node/effector/src/path.rs similarity index 100% rename from examples/ipfs_node/wasm/ipfs_node/src/path.rs rename to examples/ipfs-node/effector/src/path.rs diff --git a/examples/ipfs_node/wasm/ipfs_rpc/Cargo.toml b/examples/ipfs-node/pure/Cargo.toml similarity index 84% rename from examples/ipfs_node/wasm/ipfs_rpc/Cargo.toml rename to examples/ipfs-node/pure/Cargo.toml index 526dd35a..946248c4 100644 --- a/examples/ipfs_node/wasm/ipfs_rpc/Cargo.toml +++ b/examples/ipfs-node/pure/Cargo.toml @@ -1,11 +1,11 @@ [package] -name = "wasm_ipfs_rpc" +name = "ipfs-pure" version = "0.1.0" authors = ["Fluence Labs"] edition = "2018" [[bin]] -name = "ipfs_rpc" +name = "ipfs_pure" path = "src/main.rs" [dependencies] diff --git a/examples/ipfs_node/wasm/ipfs_rpc/src/main.rs b/examples/ipfs-node/pure/src/main.rs similarity index 100% rename from examples/ipfs_node/wasm/ipfs_rpc/src/main.rs rename to examples/ipfs-node/pure/src/main.rs diff --git a/examples/ipfs_node/Cargo.toml b/examples/ipfs_node/Cargo.toml deleted file mode 100644 index a35f3522..00000000 --- a/examples/ipfs_node/Cargo.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "ipfs_node" -version = "0.1.0" -authors = ["Fluence Labs"] -edition = "2018" - -[dependencies] -fluence-app-service = { path = "../../fluence-app-service" } -anyhow = "1.0.31" -log = "0.4.11" -env_logger = "0.7.1" diff --git a/examples/ipfs_node/src/main.rs b/examples/ipfs_node/src/main.rs deleted file mode 100644 index e03dcc39..00000000 --- a/examples/ipfs_node/src/main.rs +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2020 Fluence Labs Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -use fluence_app_service::AppService; -use fluence_app_service::IValue; - -use std::path::PathBuf; - -const IPFS_MODULES_CONFIG_PATH: &str = "Config.toml"; - -fn main() -> Result<(), anyhow::Error> { - env_logger::init(); - let mut ipfs_node = AppService::with_raw_config(); - println!("ipfs node interface is\n{}", ipfs_node.get_interface()); - - let node_address = ipfs_node.call("ipfs_node.wasm", "get_address", &[])?; - println!("ipfs node address is:\n{:?}", node_address); - - let result = ipfs_node.call( - "ipfs_rpc.wasm", - "get", - &[IValue::String( - "QmXdC36pX1B1sdHdbri859vMYctQjAhvTmkWyG9xzhShxb".to_string(), - )], - )?; - println!("execution result {:?}", result); - - Ok(()) -} diff --git a/examples/ipfs_node/wasm/artifacts/wasm_modules/ipfs_node.wasm b/examples/ipfs_node/wasm/artifacts/wasm_modules/ipfs_node.wasm deleted file mode 100644 index 8821a79b..00000000 Binary files a/examples/ipfs_node/wasm/artifacts/wasm_modules/ipfs_node.wasm and /dev/null differ diff --git a/examples/ipfs_node/wasm/artifacts/wasm_modules/ipfs_rpc.wasm b/examples/ipfs_node/wasm/artifacts/wasm_modules/ipfs_rpc.wasm deleted file mode 100755 index 5d85eaa2..00000000 Binary files a/examples/ipfs_node/wasm/artifacts/wasm_modules/ipfs_rpc.wasm and /dev/null differ diff --git a/examples/records/Cargo.toml b/examples/records/Cargo.toml deleted file mode 100644 index 66815b54..00000000 --- a/examples/records/Cargo.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "records" -version = "0.1.0" -authors = ["Fluence Labs"] -edition = "2018" - -[dependencies] -fluence-faas = { path = "../../fluence-faas" } -anyhow = "1.0.31" -log = "0.4.11" -env_logger = "0.7.1" diff --git a/examples/records/Config.toml b/examples/records/Config.toml index c76ac303..6e17e843 100644 --- a/examples/records/Config.toml +++ b/examples/records/Config.toml @@ -1,11 +1,11 @@ -core_modules_dir = "wasm/artifacts/wasm_modules" +modules_dir = "artifacts/wasm_modules" -[[core_module]] +[[module]] name = "effector.wasm" mem_pages_count = 1 logger_enabled = true -[[core_module]] +[[module]] name = "pure.wasm" mem_pages_count = 1 logger_enabled = true diff --git a/examples/records/wasm/effector/Cargo.toml b/examples/records/effector/Cargo.toml similarity index 75% rename from examples/records/wasm/effector/Cargo.toml rename to examples/records/effector/Cargo.toml index 39b2cdc6..088e33c5 100644 --- a/examples/records/wasm/effector/Cargo.toml +++ b/examples/records/effector/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "effector" +name = "record-effector" version = "0.1.0" authors = ["Fluence Labs"] edition = "2018" diff --git a/examples/records/wasm/effector/src/main.rs b/examples/records/effector/src/main.rs similarity index 100% rename from examples/records/wasm/effector/src/main.rs rename to examples/records/effector/src/main.rs diff --git a/examples/records/wasm/pure/Cargo.toml b/examples/records/pure/Cargo.toml similarity index 91% rename from examples/records/wasm/pure/Cargo.toml rename to examples/records/pure/Cargo.toml index 102c9485..33c14c03 100644 --- a/examples/records/wasm/pure/Cargo.toml +++ b/examples/records/pure/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "pure" +name = "record-pure" version = "0.1.0" authors = ["Fluence Labs"] edition = "2018" diff --git a/examples/records/wasm/pure/src/main.rs b/examples/records/pure/src/main.rs similarity index 100% rename from examples/records/wasm/pure/src/main.rs rename to examples/records/pure/src/main.rs diff --git a/examples/records/src/main.rs b/examples/records/src/main.rs deleted file mode 100644 index 59510eb5..00000000 --- a/examples/records/src/main.rs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2020 Fluence Labs Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -use fluence_faas::FluenceFaaS; - -use std::path::PathBuf; - -const RECORDS_MODULES_CONFIG_PATH: &str = "Config.toml"; - -fn main() -> Result<(), anyhow::Error> { - env_logger::init(); - - let mut records_test = FluenceFaaS::new(PathBuf::from(RECORDS_MODULES_CONFIG_PATH))?; - println!("ipfs node interface is\n{}", records_test.get_interface()); - - let result = records_test.call("pure.wasm", "invoke", &[])?; - println!("execution result {:?}", result); - - Ok(()) -} diff --git a/examples/records/wasm/test-record/Cargo.toml b/examples/records/test-record/Cargo.toml similarity index 100% rename from examples/records/wasm/test-record/Cargo.toml rename to examples/records/test-record/Cargo.toml diff --git a/examples/records/wasm/test-record/src/test_record.rs b/examples/records/test-record/src/test_record.rs similarity index 100% rename from examples/records/wasm/test-record/src/test_record.rs rename to examples/records/test-record/src/test_record.rs diff --git a/examples/records/wasm/artifacts/wasm_modules/effector.wasm b/examples/records/wasm/artifacts/wasm_modules/effector.wasm deleted file mode 100755 index 74e5108c..00000000 Binary files a/examples/records/wasm/artifacts/wasm_modules/effector.wasm and /dev/null differ diff --git a/examples/records/wasm/artifacts/wasm_modules/pure.wasm b/examples/records/wasm/artifacts/wasm_modules/pure.wasm deleted file mode 100755 index d866b6df..00000000 Binary files a/examples/records/wasm/artifacts/wasm_modules/pure.wasm and /dev/null differ