add logging mask to the AquamarineVM config

This commit is contained in:
vms 2020-10-30 16:54:46 +03:00
parent aff6695ea1
commit acf6450d22
5 changed files with 33 additions and 28 deletions

48
Cargo.lock generated
View File

@ -724,15 +724,6 @@ dependencies = [
"serde_json",
]
[[package]]
name = "fluence"
version = "0.2.8"
source = "git+https://github.com/fluencelabs/rust-sdk#8c0a02916519872c3d6073de16c950d10da0b2f4"
dependencies = [
"fluence-sdk-macro 0.2.8 (git+https://github.com/fluencelabs/rust-sdk)",
"fluence-sdk-main 0.2.8 (git+https://github.com/fluencelabs/rust-sdk)",
]
[[package]]
name = "fluence"
version = "0.2.8"
@ -743,6 +734,15 @@ dependencies = [
"fluence-sdk-main 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "fluence"
version = "0.2.8"
source = "git+https://github.com/fluencelabs/rust-sdk#8c0a02916519872c3d6073de16c950d10da0b2f4"
dependencies = [
"fluence-sdk-macro 0.2.8 (git+https://github.com/fluencelabs/rust-sdk)",
"fluence-sdk-main 0.2.8 (git+https://github.com/fluencelabs/rust-sdk)",
]
[[package]]
name = "fluence-app-service"
version = "0.1.10"
@ -780,14 +780,6 @@ dependencies = [
"wasmer-wasi-fl",
]
[[package]]
name = "fluence-sdk-macro"
version = "0.2.8"
source = "git+https://github.com/fluencelabs/rust-sdk#8c0a02916519872c3d6073de16c950d10da0b2f4"
dependencies = [
"fluence-sdk-wit 0.2.8 (git+https://github.com/fluencelabs/rust-sdk)",
]
[[package]]
name = "fluence-sdk-macro"
version = "0.2.8"
@ -798,13 +790,11 @@ dependencies = [
]
[[package]]
name = "fluence-sdk-main"
name = "fluence-sdk-macro"
version = "0.2.8"
source = "git+https://github.com/fluencelabs/rust-sdk#8c0a02916519872c3d6073de16c950d10da0b2f4"
dependencies = [
"fluence-sdk-macro 0.2.8 (git+https://github.com/fluencelabs/rust-sdk)",
"log",
"serde",
"fluence-sdk-wit 0.2.8 (git+https://github.com/fluencelabs/rust-sdk)",
]
[[package]]
@ -819,9 +809,20 @@ dependencies = [
]
[[package]]
name = "fluence-sdk-wit"
name = "fluence-sdk-main"
version = "0.2.8"
source = "git+https://github.com/fluencelabs/rust-sdk#8c0a02916519872c3d6073de16c950d10da0b2f4"
dependencies = [
"fluence-sdk-macro 0.2.8 (git+https://github.com/fluencelabs/rust-sdk)",
"log",
"serde",
]
[[package]]
name = "fluence-sdk-wit"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "560baf91197ded38a99a5c94ff366a3dd971ebf33f5d987ecce31d3dedf86d17"
dependencies = [
"proc-macro2",
"quote",
@ -834,8 +835,7 @@ dependencies = [
[[package]]
name = "fluence-sdk-wit"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "560baf91197ded38a99a5c94ff366a3dd971ebf33f5d987ecce31d3dedf86d17"
source = "git+https://github.com/fluencelabs/rust-sdk#8c0a02916519872c3d6073de16c950d10da0b2f4"
dependencies = [
"proc-macro2",
"quote",

View File

@ -49,6 +49,7 @@ impl AquamarineVM {
config.aquamarine_wasm_path,
config.call_service,
config.current_peer_id,
config.logging_mask,
);
let faas = FluenceFaaS::with_raw_config(faas_config)?;
@ -99,6 +100,7 @@ impl AquamarineVM {
aquamarine_wasm_path: PathBuf,
call_service: HostImportDescriptor,
current_peer_id: String,
logging_mask: i64,
) -> FaaSConfig {
use maplit::hashmap;
@ -114,7 +116,7 @@ impl AquamarineVM {
logger_enabled: true,
host_imports,
wasi: None,
logging_mask: i64::max_value(),
logging_mask,
}
};

View File

@ -31,4 +31,7 @@ pub struct AquamarineVMConfig {
/// Path to a folder contains prev data.
/// AquamarineVM uses it to store data obtained after stepper execution, and load it as a prev_data by particle_id.
pub particle_data_store: PathBuf,
/// Mask used to filter logs, for details see `log_utf8_string` in fluence-faas.
pub logging_mask: i64,
}

View File

@ -20,7 +20,7 @@ use wasmer_core::memory::ptr::{Array, WasmPtr};
pub(super) fn log_utf8_string_closure(
logging_mask: i64,
module: String,
) -> impl for<'a> Fn(&'a mut Ctx, i32, i64, i32, i32) {
) -> impl Fn(&mut Ctx, i32, i64, i32, i32) {
move |ctx, level, target, msg_offset, msg_size| {
if target == 0 || target & logging_mask != 0 {
log_utf8_string(&module, ctx, level, msg_offset, msg_size)

View File

@ -36,7 +36,7 @@ modules_dir = "wasm/artifacts/wasm_modules"
mem_pages_count = 100
logger_enabled = true
[module.imports]
[module.mounted_binaries]
mysql = "/usr/bin/mysql"
ipfs = "/usr/local/bin/ipfs"
@ -49,7 +49,7 @@ modules_dir = "wasm/artifacts/wasm_modules"
mem_pages_count = 100
logger_enabled = true
[default.imports]
[default.mounted_binaries]
mysql = "/usr/bin/mysql"
ipfs = "/usr/local/bin/ipfs"