From 65e54c22202b9bfc4011c77f81653862de8548da Mon Sep 17 00:00:00 2001 From: boneyard93501 Date: Thu, 10 Jun 2021 18:10:40 +0000 Subject: [PATCH] GitBook: [main] 55 pages modified --- SUMMARY.md | 3 ++- .../knowledge_aquamarine/marine/README.md | 16 ++++++++++++ .../marine/marine-rs-sdk.md | 26 +++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 knowledge_knowledge/knowledge_aquamarine/marine/README.md create mode 100644 knowledge_knowledge/knowledge_aquamarine/marine/marine-rs-sdk.md diff --git a/SUMMARY.md b/SUMMARY.md index 23fa2eb..3d692b6 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -27,7 +27,8 @@ * [AIR](knowledge_knowledge/knowledge_aquamarine/knowledge_aquamarine_air.md) * [Aqua](knowledge_knowledge/knowledge_aquamarine/hll.md) * [Aqua VM](knowledge_knowledge/knowledge_aquamarine/vm.md) - * [Marine](knowledge_knowledge/knowledge_aquamarine/marine.md) + * [Marine](knowledge_knowledge/knowledge_aquamarine/marine/README.md) + * [Marine-RS-SDK](knowledge_knowledge/knowledge_aquamarine/marine/marine-rs-sdk.md) * [Fluence Compute Engine](knowledge_knowledge/fluence-compute-engine.md) * [Node](knowledge_knowledge/node/README.md) * [Overview](knowledge_knowledge/node/overview.md) diff --git a/knowledge_knowledge/knowledge_aquamarine/marine/README.md b/knowledge_knowledge/knowledge_aquamarine/marine/README.md new file mode 100644 index 0000000..68bc56a --- /dev/null +++ b/knowledge_knowledge/knowledge_aquamarine/marine/README.md @@ -0,0 +1,16 @@ +# Marine + +[Marine](https://github.com/fluencelabs/marine) is a general purpose WebAssembly runtime favoring Wasm modules based on the [ECS](https://en.wikipedia.org/wiki/Entity_component_system) pattern or plugin architecture and uses Wasm [Interface Types](https://github.com/WebAssembly/interface-types/blob/master/proposals/interface-types/Explainer.mdhttps://github.com/WebAssembly/interface-types/blob/master/proposals/interface-types/Explainer.md) \( IT\) to implement a [shared-nothing](https://en.wikipedia.org/wiki/Shared-nothing_architecture) linking scheme. Fluence [nodes](https://github.com/fluencelabs/fluence) use Marine to host the Aqua VM and execute hosted Wasm services. + +Todo: we could really do with diagram + +The [Marine Rust SDK](https://github.com/fluencelabs/marine-rs-sdk) allows to hide the IT implementation details behind a handy procedural macro `[marine]` and provides the scaffolding for unit tests. + + + + + + + + + diff --git a/knowledge_knowledge/knowledge_aquamarine/marine/marine-rs-sdk.md b/knowledge_knowledge/knowledge_aquamarine/marine/marine-rs-sdk.md new file mode 100644 index 0000000..30abe89 --- /dev/null +++ b/knowledge_knowledge/knowledge_aquamarine/marine/marine-rs-sdk.md @@ -0,0 +1,26 @@ +# Marine-RS-SDK + +The marine-rs-sdk empowers developers to write services suitable for peer hosting in peer-to-peer networks using the Marine Virtual Machine by enabling the wasm32-wasi compile target for Marine. For an introduction to writing services with the marine-rs-sdk, see the [Developing Modules And Services](../../../development_development/) section. + +### API + +The procedural macros `[marine]` and `[marine_test]` are the two primary features provided by the SDK. The `[marine]` macro can be applied to a function, external block or structure. The `[marine_test]` macro, on the other hand, allows the use of the familiar `cargo test` to execute \(unit\) tests over the actual Wasm module generated from the service code. + +#### Function Export + +Applying the `[marine]` macro to a function results in its export, which means that it can be called from other modules or AIR scripts. For the function to be compatible with this macro, its arguments must be of the `ftype`, which is defined as follows: + +`ftype` = `bool`, `u8`, `u16`, `u32`, `u64`, `i8`, `i16`, `i32`, `i64`, `f32`, `f64`, `String` +`ftype` = `ftype` \| `Vec`<`ftype`> +`ftype` = `ftype` \| `Record`<`ftype`> + +In other words, the arguments must be one of the types listed below: + +* one of the following Rust basic types: `bool`, `u8`, `u16`, `u32`, `u64`, `i8`, `i16`, `i32`, `i64`, `f32`, `f64`, `String` +* a vector of elements of the above types +* a vector composed of vectors of the above type, where recursion is acceptable, e.g. the type `Vec>>` is permissible +* a record, where all fields are of the basic Rust types +* a record, where all fields are of any above types or other records + +The return type of a function must follow the same rules, but currently only one return type is possible. +