diff --git a/hello-world/2-hosted-services/Cargo.toml b/hello-world/2-hosted-services/Cargo.toml index 011e260..baa708e 100644 --- a/hello-world/2-hosted-services/Cargo.toml +++ b/hello-world/2-hosted-services/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "hello_world_compute" +name = "hello_peer" version = "0.1.0" authors = ["Fluence Labs"] description = "Hello world string computation" @@ -7,7 +7,7 @@ edition = "2018" publish = false [[bin]] -name = "hello_world_compute" +name = "hello_peer" path = "src/main.rs" [dependencies] diff --git a/hello-world/2-hosted-services/Config.toml b/hello-world/2-hosted-services/Config.toml index b67cdbc..ae7e302 100644 --- a/hello-world/2-hosted-services/Config.toml +++ b/hello-world/2-hosted-services/Config.toml @@ -1,6 +1,6 @@ modules_dir = "artifacts/" [[module]] - name = "hello_world_compute" + name = "hello_peer" mem_pages_count = 1 logger_enabled = false diff --git a/hello-world/2-hosted-services/app_config.json b/hello-world/2-hosted-services/app_config.json deleted file mode 100644 index 9054c4e..0000000 --- a/hello-world/2-hosted-services/app_config.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "services": { - "hello_world_compute": { - "dependencies": ["hello_world_compute"], - "node": "12D3KooWHLxVhUQyAuZe6AHMB29P7wkvTNMn7eDMcsqimJYLKREf" - } - }, - "modules": { - "hello_world_compute": { - "file": "artifacts/hello_world_compute.wasm", - "config": { - "preopened_files": [] - } - } - }, - "scripts": {}, - "script_storage": {} -} \ No newline at end of file diff --git a/hello-world/2-hosted-services/app_config_res.json b/hello-world/2-hosted-services/app_config_res.json deleted file mode 100644 index 8ce2f63..0000000 --- a/hello-world/2-hosted-services/app_config_res.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "services": { - "hello_world_compute": { - "dependencies": [ - "hello_world_compute" - ], - "node": "12D3KooWHLxVhUQyAuZe6AHMB29P7wkvTNMn7eDMcsqimJYLKREf", - "hashDependencies": [ - "hash:65267bf45b564992ceec5a5f5c36eb6f17dbbb9f0a452419ffa049d2457eeb89" - ], - "blueprint_id": "81e837fc93b970155b5c2d44e2a18d79ca88a9917db9797a271a342c0ed6516e", - "id": "ba24be5b-9789-48ac-b38a-82c9d3eb0d34" - } - }, - "modules": { - "hello_world_compute": { - "file": "artifacts/hello_world_compute.wasm", - "config": { - "preopened_files": [] - }, - "hash": "65267bf45b564992ceec5a5f5c36eb6f17dbbb9f0a452419ffa049d2457eeb89" - } - }, - "scripts": {}, - "script_storage": {} -} \ No newline at end of file diff --git a/hello-world/2-hosted-services/build.sh b/hello-world/2-hosted-services/build.sh deleted file mode 100644 index dff805b..0000000 --- a/hello-world/2-hosted-services/build.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash -set -o errexit -o nounset -o pipefail - -# This script builds all subprojects and puts all created Wasm modules in one dir -cargo update -marine build --release - -mkdir -p artifacts -rm -f artifacts/*.wasm -cp target/wasm32-wasi/release/hello_world_compute.wasm artifacts/ diff --git a/hello-world/2-hosted-services/src/main.rs b/hello-world/2-hosted-services/src/main.rs index 84036cc..9f9e905 100644 --- a/hello-world/2-hosted-services/src/main.rs +++ b/hello-world/2-hosted-services/src/main.rs @@ -19,19 +19,19 @@ use marine_rs_sdk::module_manifest; module_manifest!(); +pub fn main() {} + #[marine] -pub struct HelloComputation { +pub struct HelloPeer { pub msg: String, pub reply: String, } -pub fn main() {} - #[marine] -pub fn hello_world(from: String) -> HelloComputation { - HelloComputation { +pub fn hello(from: String) -> HelloPeer { + HelloPeer { msg: format!("Hello from: \n{}", from), - reply: format!("Hello back to you, \n{}", from) + reply: format!("Hello back to you, \n{}", from), } } @@ -41,13 +41,13 @@ mod tests { #[marine_test(config_path = "../Config.toml", modules_dir = "../artifacts")] fn empty_string() { - let actual = greeting.greeting(String::new()); + let actual = greeting.hello(String::new()); assert_eq!(actual, "Hi, "); } #[marine_test(config_path = "../Config.toml", modules_dir = "../artifacts")] fn non_empty_string() { - let actual = greeting.greeting("name".to_string()); + let actual = greeting.hello("name".to_string()); assert_eq!(actual, "Hi, name"); } }