-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(marine-book): update to marine-rs-sdk 0.14.0/marine-rs-sdk-test 0.16.1 #107
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
extern "C" { | ||
fn curl(cmd: Vec<String>) -> MountedBinaryResult; | ||
} | ||
``` | ||
|
||
Note that to import functions from a host, not from other Wasm modules, `wasm_import_module` must be equal to `"host"`. | ||
Note that to import functions from a host, not from other Wasm modules, the `extern` block must be marked by `#[host_import]` macro. | ||
|
||
The code above creates a "curl adapter", i.e., a Wasm module that allows other Wasm modules to use the the `curl_request` function, which calls the imported _curl_ binary in this case, to make http calls. Please note that we are wrapping the `extern` block with the `#[marine]` macro and introduce a Marine-native data structure `MountedBinaryResult` as the linked-function return value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here and throughout, i think we just just stick with effector, e.g., curl_effector or curl effecotr, to match with the Glossary and Glossary link-backs.
The code above creates a "curl adapter", i.e., a Wasm module that allows other Wasm modules to use the the `curl_request` function, which calls the imported _curl_ binary in this case, to make http calls. Please note that we are wrapping the `extern` block with the `#[marine]` macro and introduce a Marine-native data structure `MountedBinaryResult` as the linked-function return value. | |
The code above creates a "curl effector", i.e., a Wasm module that allows other Wasm modules to use the the `curl_request` function, which calls the imported _curl_ binary in this case, to make http calls. Please note that we are wrapping the `extern` block with the `#[marine]` macro and introduce a Marine-native data structure `MountedBinaryResult` as the linked-function return value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, the new curl module doesn't use
curl_requestany longer. it's now
curl_getand
curl_post`.
|
||
/// Id of the current service. | ||
pub service_id: String, | ||
|
||
/// Id of the service creator. | ||
pub service_creator_peer_id: String, | ||
|
||
/// Id of the host which run this service. | ||
/// PeerId of the peer who hosts worker with this service. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
somewhere along the way, marine book needs to reference/define the term worker, e.g., fluencelabs/dev-rewards#46
@@ -5,7 +5,7 @@ import TabItem from "@theme/TabItem"; | |||
|
|||
The `#[marine]` macro can also wrap a Rust [extern block](https://doc.rust-lang.org/std/keyword.extern.html). In this case, all functions declared in it are considered imported functions. If there are imported functions in some module, say, module A, then | |||
|
|||
* There should be another module, module B, that exports the same functions. The name of module B is indicated in the `link` macro (see examples below) | |||
* There should be another module, module B, that exports the same functions. The name of module B is indicated in the `module_import` macro (see examples below) | |||
* Module B should be loaded into `Marine` by the moment the loading of module A starts. Module A cannot be loaded if at least one imported function is absent in `Marine`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Module B should be loaded into `Marine` by the moment the loading of module A starts. Module A cannot be loaded if at least one imported function is absent in `Marine`. | |
* Module B should be loaded into `Marine` when the loading of module A starts. Module A cannot be loaded if one or more imported functions are missing. |
extern "C" { | ||
fn curl(cmd: Vec<String>) -> MountedBinaryResult; | ||
} | ||
``` | ||
|
||
Note that to import functions from a host, not from other Wasm modules, `wasm_import_module` must be equal to `"host"`. | ||
Note that to import functions from a host, not from other Wasm modules, the `extern` block must be marked by `#[host_import]` macro. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that to import functions from a host, not from other Wasm modules, the `extern` block must be marked by `#[host_import]` macro. | |
Note that to import functions from a host, as opposed to imports from other Wasm modules, the `extern` block must be marked by `#[host_import]` macro. |
@@ -337,7 +337,7 @@ pub fn what_o_clock(timezone: String) -> SimpleResult { | |||
// here we provide the linking info for the curl-adapter module and expose the | |||
// curl_request method to the facade module | |||
#[marine] | |||
#[link(wasm_import_module = "curl_adapter")] | |||
#[module_import("curl_adapter")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'll update the rest. thanks!
No description provided.