mirror of
https://github.com/fluencelabs/aquavm
synced 2024-12-04 15:20:16 +00:00
Decouple log targets to a separate crate (#152)
This commit is contained in:
parent
adba9e8e65
commit
e99c352a95
7
Cargo.lock
generated
7
Cargo.lock
generated
@ -17,6 +17,7 @@ version = "0.15.0"
|
||||
dependencies = [
|
||||
"air-interpreter-data",
|
||||
"air-interpreter-interface",
|
||||
"air-log-targets",
|
||||
"air-parser",
|
||||
"air-test-utils",
|
||||
"air-trace-handler",
|
||||
@ -45,6 +46,7 @@ name = "air-interpreter"
|
||||
version = "0.15.0"
|
||||
dependencies = [
|
||||
"air",
|
||||
"air-log-targets",
|
||||
"log",
|
||||
"marine-rs-sdk",
|
||||
"serde",
|
||||
@ -72,6 +74,10 @@ dependencies = [
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "air-log-targets"
|
||||
version = "0.1.0"
|
||||
|
||||
[[package]]
|
||||
name = "air-parser"
|
||||
version = "0.7.1"
|
||||
@ -113,6 +119,7 @@ name = "air-trace-handler"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"air-interpreter-data",
|
||||
"air-log-targets",
|
||||
"air-parser",
|
||||
"log",
|
||||
"serde_json",
|
||||
|
17
Cargo.toml
17
Cargo.toml
@ -2,15 +2,16 @@
|
||||
members = [
|
||||
"air",
|
||||
"air-interpreter",
|
||||
"crates/air-parser",
|
||||
"crates/data-store",
|
||||
"crates/polyplets",
|
||||
"crates/interpreter-interface",
|
||||
"crates/interpreter-data",
|
||||
"crates/test-module",
|
||||
"crates/test-utils",
|
||||
"crates/trace-handler",
|
||||
"avm/server",
|
||||
"crates/air-lib/air-parser",
|
||||
"crates/air-lib/interpreter-data",
|
||||
"crates/air-lib/interpreter-interface",
|
||||
"crates/air-lib/log-targets",
|
||||
"crates/air-lib/polyplets",
|
||||
"crates/air-lib/test-utils",
|
||||
"crates/air-lib/trace-handler",
|
||||
"crates/data-store",
|
||||
"crates/test-module",
|
||||
]
|
||||
|
||||
exclude = [
|
||||
|
@ -16,6 +16,7 @@ path = "src/marine.rs"
|
||||
|
||||
[dependencies]
|
||||
air = { path = "../air" }
|
||||
air-log-targets = { path = "../crates/air-lib/log-targets" }
|
||||
|
||||
marine-rs-sdk = { version = "0.6.11", features = ["logger"] }
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
use air::log_targets::TARGET_MAP;
|
||||
use air_log_targets::TARGET_MAP;
|
||||
|
||||
use log::LevelFilter;
|
||||
|
||||
|
@ -11,12 +11,13 @@ path = "src/lib.rs"
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
air-parser = { path = "../crates/air-parser" }
|
||||
air-interpreter-data = { path = "../crates/interpreter-data" }
|
||||
air-interpreter-interface = { path = "../crates/interpreter-interface" }
|
||||
air-trace-handler = { path = "../crates/trace-handler" }
|
||||
air-parser = { path = "../crates/air-lib/air-parser" }
|
||||
air-interpreter-data = { path = "../crates/air-lib/interpreter-data" }
|
||||
air-interpreter-interface = { path = "../crates/air-lib/interpreter-interface" }
|
||||
air-log-targets = { path = "../crates/air-lib/log-targets" }
|
||||
air-trace-handler = { path = "../crates/air-lib/trace-handler" }
|
||||
polyplets = { path = "../crates/air-lib/polyplets" }
|
||||
marine-rs-sdk = { version = "0.6.11", features = ["logger"] }
|
||||
polyplets = { path = "../crates/polyplets" }
|
||||
|
||||
serde = { version = "1.0.118", features = [ "derive", "rc" ] }
|
||||
serde_json = "1.0.61"
|
||||
@ -33,7 +34,7 @@ strum_macros = "0.21"
|
||||
wasm-bindgen = "=0.2.65"
|
||||
|
||||
[dev_dependencies]
|
||||
air-test-utils = { path = "../crates/test-utils" }
|
||||
air-test-utils = { path = "../crates/air-lib/test-utils" }
|
||||
fluence-app-service = "0.9.0"
|
||||
|
||||
criterion = "0.3.3"
|
||||
|
@ -144,7 +144,7 @@ impl<'i> ExecutableInstruction<'i> for Instruction<'i> {
|
||||
#[macro_export]
|
||||
macro_rules! log_instruction {
|
||||
($instr_name:expr, $exec_ctx:expr, $trace_ctx:expr) => {
|
||||
log::debug!(target: crate::log_targets::INSTRUCTION, "> {}", stringify!($instr_name));
|
||||
log::debug!(target: air_log_targets::INSTRUCTION, "> {}", stringify!($instr_name));
|
||||
|
||||
let mut variables = String::from(" scalars:");
|
||||
if $exec_ctx.scalars.is_empty() {
|
||||
@ -162,25 +162,25 @@ macro_rules! log_instruction {
|
||||
variables.push_str(&format!("\n {} => {}", key, value.borrow()));
|
||||
}
|
||||
|
||||
log::trace!(target: crate::log_targets::DATA_CACHE, "{}", variables);
|
||||
log::trace!(target: air_log_targets::DATA_CACHE, "{}", variables);
|
||||
log::trace!(
|
||||
target: crate::log_targets::NEXT_PEER_PKS,
|
||||
target: air_log_targets::NEXT_PEER_PKS,
|
||||
" next peers pk: {:?}",
|
||||
$exec_ctx.next_peer_pks
|
||||
);
|
||||
log::trace!(
|
||||
target: crate::log_targets::SUBTREE_COMPLETE,
|
||||
target: air_log_targets::SUBTREE_COMPLETE,
|
||||
" subtree complete: {}",
|
||||
$exec_ctx.subtree_complete
|
||||
);
|
||||
|
||||
log::trace!(
|
||||
target: crate::log_targets::SUBTREE_ELEMENTS,
|
||||
target: air_log_targets::SUBTREE_ELEMENTS,
|
||||
" subtree elements count: {:?}",
|
||||
$trace_ctx.subtree_sizes()
|
||||
);
|
||||
log::debug!(
|
||||
target: crate::log_targets::NEW_EXECUTED_TRACE,
|
||||
target: air_log_targets::NEW_EXECUTED_TRACE,
|
||||
" new call executed trace: {:?}",
|
||||
$trace_ctx.as_result_trace()
|
||||
);
|
||||
|
@ -155,7 +155,7 @@ impl ExecutionError {
|
||||
|
||||
macro_rules! log_join {
|
||||
($($args:tt)*) => {
|
||||
log::info!(target: crate::log_targets::JOIN_BEHAVIOUR, $($args)*)
|
||||
log::info!(target: air_log_targets::JOIN_BEHAVIOUR, $($args)*)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,8 +28,6 @@
|
||||
|
||||
mod execution_step;
|
||||
mod preparation_step;
|
||||
|
||||
pub mod log_targets;
|
||||
mod runner;
|
||||
|
||||
pub use air_interpreter_interface::InterpreterOutcome;
|
||||
|
@ -16,16 +16,18 @@
|
||||
|
||||
mod outcome;
|
||||
|
||||
use crate::execution_step::Catchable;
|
||||
use crate::execution_step::ExecutableInstruction;
|
||||
use crate::execution_step::ExecutionCtx;
|
||||
use crate::execution_step::ExecutionError;
|
||||
use crate::execution_step::{Catchable, TraceHandler};
|
||||
use crate::log_targets::RUN_PARAMS;
|
||||
use crate::execution_step::TraceHandler;
|
||||
use crate::preparation_step::prepare;
|
||||
use crate::preparation_step::PreparationDescriptor;
|
||||
|
||||
use air_interpreter_interface::InterpreterOutcome;
|
||||
use air_interpreter_interface::RunParameters;
|
||||
use air_log_targets::RUN_PARAMS;
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
pub fn execute_air(
|
||||
|
@ -12,9 +12,9 @@ path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
fluence-faas = "0.9.0"
|
||||
air-interpreter-interface = { version = "0.7.0", path = "../../crates/interpreter-interface" }
|
||||
air-interpreter-interface = { version = "0.7.0", path = "../../crates/air-lib/interpreter-interface" }
|
||||
avm-data-store = { version = "0.1.0", path = "../../crates/data-store" }
|
||||
polyplets = { version = "0.1.2", path = "../../crates/polyplets" }
|
||||
polyplets = { version = "0.1.2", path = "../../crates/air-lib/polyplets" }
|
||||
|
||||
eyre = "0.6.5"
|
||||
thiserror = "1.0.29"
|
||||
|
15
crates/air-lib/log-targets/Cargo.toml
Normal file
15
crates/air-lib/log-targets/Cargo.toml
Normal file
@ -0,0 +1,15 @@
|
||||
[package]
|
||||
name = "air-log-targets"
|
||||
version = "0.1.0"
|
||||
description = "Definition of global consts used for logging"
|
||||
authors = ["Fluence Labs"]
|
||||
edition = "2018"
|
||||
license = "Apache-2.0"
|
||||
repository = "https://github.com/fluencelabs/air/crates/log-targets"
|
||||
publish = false
|
||||
keywords = ["fluence", "air", "webassembly", "programming-language"]
|
||||
categories = ["wasm"]
|
||||
|
||||
[lib]
|
||||
name = "air_log_targets"
|
||||
path = "src/lib.rs"
|
3
crates/air-lib/log-targets/README.md
Normal file
3
crates/air-lib/log-targets/README.md
Normal file
@ -0,0 +1,3 @@
|
||||
## AIR logger targets
|
||||
|
||||
The marine logger allows adjusting not only by a logging level defined in the `log` crate, but also by a component id (or targets in terms of the `log` crate). So, it could be considered as a matrix where each component could have its own logging level. This crate defines several component id that are used by other crates.
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2020 Fluence Labs Limited
|
||||
* Copyright 2021 Fluence Labs Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
@ -11,9 +11,9 @@ name = "air_test_utils"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
air = { path = "../../../air" }
|
||||
air-interpreter-interface = { path = "../interpreter-interface" }
|
||||
avm-server = { path = "../../../avm/server" }
|
||||
marine-rs-sdk = "0.6.11"
|
||||
avm-server = { path = "../../avm/server" }
|
||||
air = { path = "../../air" }
|
||||
air-interpreter-interface = { path = "../../crates/interpreter-interface" }
|
||||
|
||||
serde_json = "1.0.61"
|
@ -16,6 +16,7 @@ path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
air-interpreter-data = { path = "../interpreter-data" }
|
||||
air-log-targets = { path = "../log-targets" }
|
||||
air-parser = { path = "../air-parser" }
|
||||
|
||||
serde_json = "1.0.68"
|
@ -1,6 +1,6 @@
|
||||
## AIR trace handler
|
||||
|
||||
This crate contains implementation of the CRDT-based merging data algorithm. It exposes the `TraceHandler` struct that based on the visitor pattern and has public methods that should be called in certain places of AIR instructions execution. Internally `TraceHandler` contains several FSM and each such public methods do state transitioning of one or more these FSMs. Below are state transition sequences for all instructions that caller must follow.
|
||||
This crate contains implementation of the CRDT-based merging data algorithm. It exposes the `TraceHandler` struct that based on the visitor pattern and has public methods that should be called in certain places of AIR instructions execution. Internally `TraceHandler` contains several FSM and each of such public methods does state transitioning of one or more these FSMs. Below are state transition sequences for all instructions that caller must follow.
|
||||
|
||||
### Ap instruction
|
||||
|
@ -68,7 +68,7 @@ impl TraceHandler {
|
||||
/// state to the result trace.
|
||||
pub fn meet_call_end(&mut self, call_result: CallResult) {
|
||||
log::trace!(
|
||||
target: crate::EXECUTED_STATE_CHANGING,
|
||||
target: air_log_targets::EXECUTED_STATE_CHANGING,
|
||||
" adding new call executed state {:?}",
|
||||
call_result
|
||||
);
|
@ -33,8 +33,6 @@ pub use state_automata::SubtreeType;
|
||||
|
||||
pub type TraceHandlerResult<T> = std::result::Result<T, TraceHandlerError>;
|
||||
|
||||
pub const EXECUTED_STATE_CHANGING: &str = "executed_state_changing";
|
||||
|
||||
use air_interpreter_data::*;
|
||||
use data_keeper::DataKeeper;
|
||||
use data_keeper::MergeCtx;
|
Loading…
Reference in New Issue
Block a user