mirror of
https://github.com/fluencelabs/marine.git
synced 2025-03-15 05:50:49 +00:00
update readme
This commit is contained in:
parent
58244d4758
commit
ecf9b1b34f
18
README.md
18
README.md
@ -70,30 +70,30 @@ extern "C" {
|
|||||||
- Create simple Rust project
|
- Create simple Rust project
|
||||||
- Create `Config.toml` to describe existed wasm modules and give accesses to host binaries and local storage if needed:
|
- Create `Config.toml` to describe existed wasm modules and give accesses to host binaries and local storage if needed:
|
||||||
```toml
|
```toml
|
||||||
core_modules_dir = "wasm/artifacts/modules"
|
modules_dir = "wasm/artifacts/modules"
|
||||||
|
|
||||||
[[core_module]]
|
[[module]]
|
||||||
name = "wasm_local_storage_with_curl.wasm"
|
name = "wasm_local_storage_with_curl.wasm"
|
||||||
mem_pages_count = 100
|
mem_pages_count = 100
|
||||||
|
|
||||||
[core_module.imports]
|
[module.imports]
|
||||||
curl = "/usr/bin/curl"
|
curl = "/usr/bin/curl"
|
||||||
|
|
||||||
[core_module.wasi]
|
[module.wasi]
|
||||||
envs = []
|
envs = []
|
||||||
preopened_files = ["./wasm/artifacts"]
|
preopened_files = ["./wasm/artifacts"]
|
||||||
mapped_dirs = { "tmp" = "./wasm/artifacts" }
|
mapped_dirs = { "tmp" = "./wasm/artifacts" }
|
||||||
```
|
```
|
||||||
|
|
||||||
`core_modules_dir` - path to directory with all modules. All subsequent paths will be relative to this path
|
`modules_dir` - path to directory with all modules. All subsequent paths will be relative to this path
|
||||||
|
|
||||||
`[[core_module]]` - modules list
|
`[[module]]` - modules list
|
||||||
|
|
||||||
`name` - wasm file name in `core_modules_dir`
|
`name` - wasm file name in `modules_dir`
|
||||||
|
|
||||||
`mem_pages_count` - a maximum number of Wasm memory pages that loaded module can use. Each Wasm pages is 65536 bytes long
|
`mem_pages_count` - a maximum number of Wasm memory pages that loaded module can use. Each Wasm pages is 65536 bytes long
|
||||||
|
|
||||||
`[core_module.imports]` - list of available imports
|
`[module.imports]` - list of available imports
|
||||||
|
|
||||||
`curl = "/usr/bin/curl"` - gives possibility to call binary file `/usr/bin/curl` as method `curl` in Rust code
|
`curl = "/usr/bin/curl"` - gives possibility to call binary file `/usr/bin/curl` as method `curl` in Rust code
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ extern "C" {
|
|||||||
|
|
||||||
Call binary with arguments: `curl("-vvv ya.ru")`
|
Call binary with arguments: `curl("-vvv ya.ru")`
|
||||||
|
|
||||||
`[core_module.wasi]` - this block manages communication with the "outside" world
|
`[module.wasi]` - this block manages communication with the "outside" world
|
||||||
`env` - environment variables. Usage: `std::env::var("IPFS_ADDR")`
|
`env` - environment variables. Usage: `std::env::var("IPFS_ADDR")`
|
||||||
`preopened_files` - list of available directories for loaded modules
|
`preopened_files` - list of available directories for loaded modules
|
||||||
`mapped_dirs` - mapping between paths
|
`mapped_dirs` - mapping between paths
|
||||||
|
@ -21,7 +21,7 @@ use once_cell::sync::Lazy;
|
|||||||
|
|
||||||
static GREETING_WASM_BYTES: Lazy<Vec<u8>> = Lazy::new(|| {
|
static GREETING_WASM_BYTES: Lazy<Vec<u8>> = Lazy::new(|| {
|
||||||
std::fs::read("../examples/greeting/artifacts/greeting.wasm")
|
std::fs::read("../examples/greeting/artifacts/greeting.wasm")
|
||||||
.expect("examples/greeting/artifacts/greeting.wasm should presence")
|
.expect("../examples/greeting/artifacts/greeting.wasm should presence")
|
||||||
});
|
});
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -21,11 +21,11 @@ use fce::IValue;
|
|||||||
#[ignore]
|
#[ignore]
|
||||||
pub fn records() {
|
pub fn records() {
|
||||||
let effector_wasm_bytes =
|
let effector_wasm_bytes =
|
||||||
std::fs::read("../examples/records/artifacts/wasm_modules/effector.wasm")
|
std::fs::read("../examples/records/artifacts/wasm_modules/effector")
|
||||||
.expect("examples/records/artifacts/wasm_modules/effector.wasm should presence");
|
.expect("../examples/records/artifacts/wasm_modules/effector.wasm should presence");
|
||||||
|
|
||||||
let pure_wasm_bytes = std::fs::read("../examples/records/artifacts/wasm_modules/pure.wasm")
|
let pure_wasm_bytes = std::fs::read("../examples/records/artifacts/wasm_modules/pure")
|
||||||
.expect("examples/records/artifacts/wasm_modules/pure.wasm should presence");
|
.expect("../examples/records/artifacts/wasm_modules/pure.wasm should presence");
|
||||||
|
|
||||||
let mut fce = FCE::new();
|
let mut fce = FCE::new();
|
||||||
let load_result = fce.load_module("pure", &pure_wasm_bytes, <_>::default());
|
let load_result = fce.load_module("pure", &pure_wasm_bytes, <_>::default());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user