diff --git a/hello-world/2-hosted-services/Cargo.toml b/hello-world/2-hosted-services/Cargo.toml index baa708e..2f1906a 100644 --- a/hello-world/2-hosted-services/Cargo.toml +++ b/hello-world/2-hosted-services/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "hello_peer" +name = "hello-world" version = "0.1.0" authors = ["Fluence Labs"] description = "Hello world string computation" @@ -7,7 +7,7 @@ edition = "2018" publish = false [[bin]] -name = "hello_peer" +name = "hello_world" path = "src/main.rs" [dependencies] diff --git a/hello-world/2-hosted-services/Config.toml b/hello-world/2-hosted-services/configs/Config.toml similarity index 78% rename from hello-world/2-hosted-services/Config.toml rename to hello-world/2-hosted-services/configs/Config.toml index ae7e302..a35f06e 100644 --- a/hello-world/2-hosted-services/Config.toml +++ b/hello-world/2-hosted-services/configs/Config.toml @@ -1,6 +1,6 @@ modules_dir = "artifacts/" [[module]] - name = "hello_peer" + name = "hello_world" mem_pages_count = 1 logger_enabled = false diff --git a/hello-world/2-hosted-services/configs/app_config.json b/hello-world/2-hosted-services/configs/app_config.json index 9054c4e..6058c9c 100644 --- a/hello-world/2-hosted-services/configs/app_config.json +++ b/hello-world/2-hosted-services/configs/app_config.json @@ -1,13 +1,13 @@ { "services": { "hello_world_compute": { - "dependencies": ["hello_world_compute"], + "dependencies": ["hello_world"], "node": "12D3KooWHLxVhUQyAuZe6AHMB29P7wkvTNMn7eDMcsqimJYLKREf" } }, "modules": { "hello_world_compute": { - "file": "artifacts/hello_world_compute.wasm", + "file": "artifacts/hello_world.wasm", "config": { "preopened_files": [] } diff --git a/hello-world/2-hosted-services/configs/app_config_res.json b/hello-world/2-hosted-services/configs/app_config_res.json index 8ce2f63..8c6f6bc 100644 --- a/hello-world/2-hosted-services/configs/app_config_res.json +++ b/hello-world/2-hosted-services/configs/app_config_res.json @@ -1,6 +1,6 @@ { "services": { - "hello_world_compute": { + "hello_world": { "dependencies": [ "hello_world_compute" ], @@ -14,7 +14,7 @@ }, "modules": { "hello_world_compute": { - "file": "artifacts/hello_world_compute.wasm", + "file": "artifacts/hello_world.wasm", "config": { "preopened_files": [] }, diff --git a/hello-world/2-hosted-services/configs/hello_world_cfg.json b/hello-world/2-hosted-services/configs/hello_world_cfg.json new file mode 100644 index 0000000..cf9bbcf --- /dev/null +++ b/hello-world/2-hosted-services/configs/hello_world_cfg.json @@ -0,0 +1,5 @@ +{ + "name": "hello_world", + "mem_pages_count": 1, + "logger_enabled": false +} \ No newline at end of file diff --git a/hello-world/2-hosted-services/scripts/build.sh b/hello-world/2-hosted-services/scripts/build.sh index 116825b..cc2d592 100755 --- a/hello-world/2-hosted-services/scripts/build.sh +++ b/hello-world/2-hosted-services/scripts/build.sh @@ -7,4 +7,4 @@ marine build --release mkdir -p artifacts rm -f artifacts/*.wasm -cp target/wasm32-wasi/release/hello_peer.wasm artifacts/ +cp target/wasm32-wasi/release/hello_world.wasm artifacts/ diff --git a/hello-world/2-hosted-services/src/main.rs b/hello-world/2-hosted-services/src/main.rs index 9f9e905..c09adda 100644 --- a/hello-world/2-hosted-services/src/main.rs +++ b/hello-world/2-hosted-services/src/main.rs @@ -22,14 +22,14 @@ module_manifest!(); pub fn main() {} #[marine] -pub struct HelloPeer { +pub struct HelloWorld { pub msg: String, pub reply: String, } #[marine] -pub fn hello(from: String) -> HelloPeer { - HelloPeer { +pub fn hello(from: String) -> HelloWorld { + HelloWorld { msg: format!("Hello from: \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.hello(String::new()); + let actual = hello_world.hello(String::new()); assert_eq!(actual, "Hi, "); } #[marine_test(config_path = "../Config.toml", modules_dir = "../artifacts")] fn non_empty_string() { - let actual = greeting.hello("name".to_string()); + let actual = hello_world.hello("name".to_string()); assert_eq!(actual, "Hi, name"); } }