From e99c352a952922202ffef961ee3008243a27f8e1 Mon Sep 17 00:00:00 2001 From: Mike Voronov Date: Tue, 5 Oct 2021 16:55:04 +0300 Subject: [PATCH] Decouple log targets to a separate crate (#152) --- Cargo.lock | 7 +++++++ Cargo.toml | 17 +++++++++-------- air-interpreter/Cargo.toml | 1 + air-interpreter/src/logger.rs | 2 +- air/Cargo.toml | 13 +++++++------ air/src/execution_step/air/mod.rs | 12 ++++++------ air/src/execution_step/errors.rs | 2 +- air/src/lib.rs | 2 -- air/src/runner.rs | 6 ++++-- avm/server/Cargo.toml | 4 ++-- crates/{ => air-lib}/air-parser/Cargo.toml | 0 .../{ => air-lib}/air-parser/benches/parser.rs | 0 crates/{ => air-lib}/air-parser/build.rs | 0 crates/{ => air-lib}/air-parser/src/lib.rs | 0 .../air-parser/src/parser/air.lalrpop | 0 .../{ => air-lib}/air-parser/src/parser/air.rs | 0 .../air-parser/src/parser/air_parser.rs | 0 .../{ => air-lib}/air-parser/src/parser/ast.rs | 0 .../air-parser/src/parser/ast/impls.rs | 0 .../air-parser/src/parser/ast/traits.rs | 0 .../air-parser/src/parser/errors.rs | 0 .../air-parser/src/parser/lexer/air_lexer.rs | 0 .../src/parser/lexer/call_variable_parser.rs | 0 .../air-parser/src/parser/lexer/errors.rs | 0 .../air-parser/src/parser/lexer/mod.rs | 0 .../air-parser/src/parser/lexer/tests.rs | 0 .../air-parser/src/parser/lexer/token.rs | 0 .../air-parser/src/parser/lexer/token/traits.rs | 0 .../air-parser/src/parser/lexer/utils.rs | 0 .../{ => air-lib}/air-parser/src/parser/mod.rs | 0 .../air-parser/src/parser/tests.rs | 0 .../air-parser/src/parser/validator.rs | 0 .../{ => air-lib}/interpreter-data/CHANGELOG.md | 0 .../{ => air-lib}/interpreter-data/Cargo.toml | 0 .../interpreter-data/src/executed_state.rs | 0 .../src/executed_state/impls.rs | 0 .../src/executed_state/se_de.rs | 0 .../interpreter-data/src/interpreter_data.rs | 0 .../{ => air-lib}/interpreter-data/src/lib.rs | 0 .../interpreter-interface/Cargo.toml | 0 .../src/call_request_parameters.rs | 0 .../src/call_service_result.rs | 0 .../src/interpreter_outcome.rs | 0 .../interpreter-interface/src/lib.rs | 0 .../interpreter-interface/src/run_parameters.rs | 0 crates/air-lib/log-targets/Cargo.toml | 15 +++++++++++++++ crates/air-lib/log-targets/README.md | 3 +++ .../air-lib/log-targets/src/lib.rs | 2 +- crates/{ => air-lib}/polyplets/Cargo.toml | 0 crates/{ => air-lib}/polyplets/src/lib.rs | 0 crates/{ => air-lib}/polyplets/src/tetraplet.rs | 0 crates/{ => air-lib}/polyplets/src/triplet.rs | 0 crates/{ => air-lib}/test-utils/Cargo.toml | 6 +++--- .../test-utils/src/call_services.rs | 0 .../test-utils/src/executed_state.rs | 0 crates/{ => air-lib}/test-utils/src/lib.rs | 0 .../{ => air-lib}/test-utils/src/test_runner.rs | 0 .../{ => air-lib}/trace-handler/.rustfmt.toml | 0 crates/{ => air-lib}/trace-handler/Cargo.toml | 1 + crates/{ => air-lib}/trace-handler/README.md | 2 +- .../trace-handler/src/data_keeper/errors.rs | 0 .../trace-handler/src/data_keeper/keeper.rs | 0 .../trace-handler/src/data_keeper/merge_ctx.rs | 0 .../trace-handler/src/data_keeper/mod.rs | 0 .../src/data_keeper/trace_slider.rs | 0 .../{ => air-lib}/trace-handler/src/errors.rs | 0 .../{ => air-lib}/trace-handler/src/handler.rs | 2 +- crates/{ => air-lib}/trace-handler/src/lib.rs | 2 -- .../trace-handler/src/merger/ap_merger.rs | 0 .../trace-handler/src/merger/call_merger.rs | 0 .../call_merger/call_result_constructor.rs | 0 .../src/merger/call_merger/utils.rs | 0 .../trace-handler/src/merger/errors.rs | 0 .../trace-handler/src/merger/fold_merger.rs | 0 .../merger/fold_merger/fold_lore_resolver.rs | 0 .../trace-handler/src/merger/mod.rs | 0 .../trace-handler/src/merger/par_merger.rs | 0 .../trace-handler/src/state_automata/errors.rs | 0 .../src/state_automata/fold_fsm.rs | 0 .../src/state_automata/fold_fsm/lore_applier.rs | 0 .../src/state_automata/fold_fsm/lore_ctor.rs | 0 .../state_automata/fold_fsm/lore_ctor_queue.rs | 0 .../state_automata/fold_fsm/state_handler.rs | 0 .../src/state_automata/fsm_queue.rs | 0 .../trace-handler/src/state_automata/mod.rs | 0 .../trace-handler/src/state_automata/par_fsm.rs | 0 .../src/state_automata/par_fsm/par_builder.rs | 0 .../src/state_automata/par_fsm/state_handler.rs | 0 .../state_handler/new_states_calculation.rs | 0 .../src/state_automata/state_inserter.rs | 0 .../trace-handler/src/state_automata/utils.rs | 0 91 files changed, 63 insertions(+), 36 deletions(-) rename crates/{ => air-lib}/air-parser/Cargo.toml (100%) rename crates/{ => air-lib}/air-parser/benches/parser.rs (100%) rename crates/{ => air-lib}/air-parser/build.rs (100%) rename crates/{ => air-lib}/air-parser/src/lib.rs (100%) rename crates/{ => air-lib}/air-parser/src/parser/air.lalrpop (100%) rename crates/{ => air-lib}/air-parser/src/parser/air.rs (100%) rename crates/{ => air-lib}/air-parser/src/parser/air_parser.rs (100%) rename crates/{ => air-lib}/air-parser/src/parser/ast.rs (100%) rename crates/{ => air-lib}/air-parser/src/parser/ast/impls.rs (100%) rename crates/{ => air-lib}/air-parser/src/parser/ast/traits.rs (100%) rename crates/{ => air-lib}/air-parser/src/parser/errors.rs (100%) rename crates/{ => air-lib}/air-parser/src/parser/lexer/air_lexer.rs (100%) rename crates/{ => air-lib}/air-parser/src/parser/lexer/call_variable_parser.rs (100%) rename crates/{ => air-lib}/air-parser/src/parser/lexer/errors.rs (100%) rename crates/{ => air-lib}/air-parser/src/parser/lexer/mod.rs (100%) rename crates/{ => air-lib}/air-parser/src/parser/lexer/tests.rs (100%) rename crates/{ => air-lib}/air-parser/src/parser/lexer/token.rs (100%) rename crates/{ => air-lib}/air-parser/src/parser/lexer/token/traits.rs (100%) rename crates/{ => air-lib}/air-parser/src/parser/lexer/utils.rs (100%) rename crates/{ => air-lib}/air-parser/src/parser/mod.rs (100%) rename crates/{ => air-lib}/air-parser/src/parser/tests.rs (100%) rename crates/{ => air-lib}/air-parser/src/parser/validator.rs (100%) rename crates/{ => air-lib}/interpreter-data/CHANGELOG.md (100%) rename crates/{ => air-lib}/interpreter-data/Cargo.toml (100%) rename crates/{ => air-lib}/interpreter-data/src/executed_state.rs (100%) rename crates/{ => air-lib}/interpreter-data/src/executed_state/impls.rs (100%) rename crates/{ => air-lib}/interpreter-data/src/executed_state/se_de.rs (100%) rename crates/{ => air-lib}/interpreter-data/src/interpreter_data.rs (100%) rename crates/{ => air-lib}/interpreter-data/src/lib.rs (100%) rename crates/{ => air-lib}/interpreter-interface/Cargo.toml (100%) rename crates/{ => air-lib}/interpreter-interface/src/call_request_parameters.rs (100%) rename crates/{ => air-lib}/interpreter-interface/src/call_service_result.rs (100%) rename crates/{ => air-lib}/interpreter-interface/src/interpreter_outcome.rs (100%) rename crates/{ => air-lib}/interpreter-interface/src/lib.rs (100%) rename crates/{ => air-lib}/interpreter-interface/src/run_parameters.rs (100%) create mode 100644 crates/air-lib/log-targets/Cargo.toml create mode 100644 crates/air-lib/log-targets/README.md rename air/src/log_targets.rs => crates/air-lib/log-targets/src/lib.rs (98%) rename crates/{ => air-lib}/polyplets/Cargo.toml (100%) rename crates/{ => air-lib}/polyplets/src/lib.rs (100%) rename crates/{ => air-lib}/polyplets/src/tetraplet.rs (100%) rename crates/{ => air-lib}/polyplets/src/triplet.rs (100%) rename crates/{ => air-lib}/test-utils/Cargo.toml (62%) rename crates/{ => air-lib}/test-utils/src/call_services.rs (100%) rename crates/{ => air-lib}/test-utils/src/executed_state.rs (100%) rename crates/{ => air-lib}/test-utils/src/lib.rs (100%) rename crates/{ => air-lib}/test-utils/src/test_runner.rs (100%) rename crates/{ => air-lib}/trace-handler/.rustfmt.toml (100%) rename crates/{ => air-lib}/trace-handler/Cargo.toml (92%) rename crates/{ => air-lib}/trace-handler/README.md (84%) rename crates/{ => air-lib}/trace-handler/src/data_keeper/errors.rs (100%) rename crates/{ => air-lib}/trace-handler/src/data_keeper/keeper.rs (100%) rename crates/{ => air-lib}/trace-handler/src/data_keeper/merge_ctx.rs (100%) rename crates/{ => air-lib}/trace-handler/src/data_keeper/mod.rs (100%) rename crates/{ => air-lib}/trace-handler/src/data_keeper/trace_slider.rs (100%) rename crates/{ => air-lib}/trace-handler/src/errors.rs (100%) rename crates/{ => air-lib}/trace-handler/src/handler.rs (98%) rename crates/{ => air-lib}/trace-handler/src/lib.rs (95%) rename crates/{ => air-lib}/trace-handler/src/merger/ap_merger.rs (100%) rename crates/{ => air-lib}/trace-handler/src/merger/call_merger.rs (100%) rename crates/{ => air-lib}/trace-handler/src/merger/call_merger/call_result_constructor.rs (100%) rename crates/{ => air-lib}/trace-handler/src/merger/call_merger/utils.rs (100%) rename crates/{ => air-lib}/trace-handler/src/merger/errors.rs (100%) rename crates/{ => air-lib}/trace-handler/src/merger/fold_merger.rs (100%) rename crates/{ => air-lib}/trace-handler/src/merger/fold_merger/fold_lore_resolver.rs (100%) rename crates/{ => air-lib}/trace-handler/src/merger/mod.rs (100%) rename crates/{ => air-lib}/trace-handler/src/merger/par_merger.rs (100%) rename crates/{ => air-lib}/trace-handler/src/state_automata/errors.rs (100%) rename crates/{ => air-lib}/trace-handler/src/state_automata/fold_fsm.rs (100%) rename crates/{ => air-lib}/trace-handler/src/state_automata/fold_fsm/lore_applier.rs (100%) rename crates/{ => air-lib}/trace-handler/src/state_automata/fold_fsm/lore_ctor.rs (100%) rename crates/{ => air-lib}/trace-handler/src/state_automata/fold_fsm/lore_ctor_queue.rs (100%) rename crates/{ => air-lib}/trace-handler/src/state_automata/fold_fsm/state_handler.rs (100%) rename crates/{ => air-lib}/trace-handler/src/state_automata/fsm_queue.rs (100%) rename crates/{ => air-lib}/trace-handler/src/state_automata/mod.rs (100%) rename crates/{ => air-lib}/trace-handler/src/state_automata/par_fsm.rs (100%) rename crates/{ => air-lib}/trace-handler/src/state_automata/par_fsm/par_builder.rs (100%) rename crates/{ => air-lib}/trace-handler/src/state_automata/par_fsm/state_handler.rs (100%) rename crates/{ => air-lib}/trace-handler/src/state_automata/par_fsm/state_handler/new_states_calculation.rs (100%) rename crates/{ => air-lib}/trace-handler/src/state_automata/state_inserter.rs (100%) rename crates/{ => air-lib}/trace-handler/src/state_automata/utils.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index dcb105d7..eec0eca3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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", diff --git a/Cargo.toml b/Cargo.toml index 8a3c5957..943f07b9 100644 --- a/Cargo.toml +++ b/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 = [ diff --git a/air-interpreter/Cargo.toml b/air-interpreter/Cargo.toml index f14b1660..35b289da 100644 --- a/air-interpreter/Cargo.toml +++ b/air-interpreter/Cargo.toml @@ -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"] } diff --git a/air-interpreter/src/logger.rs b/air-interpreter/src/logger.rs index 2afdd5b0..a7e62581 100644 --- a/air-interpreter/src/logger.rs +++ b/air-interpreter/src/logger.rs @@ -14,7 +14,7 @@ * limitations under the License. */ -use air::log_targets::TARGET_MAP; +use air_log_targets::TARGET_MAP; use log::LevelFilter; diff --git a/air/Cargo.toml b/air/Cargo.toml index 1ef07e92..234f1429 100644 --- a/air/Cargo.toml +++ b/air/Cargo.toml @@ -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" diff --git a/air/src/execution_step/air/mod.rs b/air/src/execution_step/air/mod.rs index d23bf6b5..20326494 100644 --- a/air/src/execution_step/air/mod.rs +++ b/air/src/execution_step/air/mod.rs @@ -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() ); diff --git a/air/src/execution_step/errors.rs b/air/src/execution_step/errors.rs index 19e5aae8..6b818489 100644 --- a/air/src/execution_step/errors.rs +++ b/air/src/execution_step/errors.rs @@ -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)*) } } diff --git a/air/src/lib.rs b/air/src/lib.rs index a3b3b1a8..d8a02cd9 100644 --- a/air/src/lib.rs +++ b/air/src/lib.rs @@ -28,8 +28,6 @@ mod execution_step; mod preparation_step; - -pub mod log_targets; mod runner; pub use air_interpreter_interface::InterpreterOutcome; diff --git a/air/src/runner.rs b/air/src/runner.rs index 78eb94ec..3daec9eb 100644 --- a/air/src/runner.rs +++ b/air/src/runner.rs @@ -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( diff --git a/avm/server/Cargo.toml b/avm/server/Cargo.toml index d345df0c..9e952944 100644 --- a/avm/server/Cargo.toml +++ b/avm/server/Cargo.toml @@ -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" diff --git a/crates/air-parser/Cargo.toml b/crates/air-lib/air-parser/Cargo.toml similarity index 100% rename from crates/air-parser/Cargo.toml rename to crates/air-lib/air-parser/Cargo.toml diff --git a/crates/air-parser/benches/parser.rs b/crates/air-lib/air-parser/benches/parser.rs similarity index 100% rename from crates/air-parser/benches/parser.rs rename to crates/air-lib/air-parser/benches/parser.rs diff --git a/crates/air-parser/build.rs b/crates/air-lib/air-parser/build.rs similarity index 100% rename from crates/air-parser/build.rs rename to crates/air-lib/air-parser/build.rs diff --git a/crates/air-parser/src/lib.rs b/crates/air-lib/air-parser/src/lib.rs similarity index 100% rename from crates/air-parser/src/lib.rs rename to crates/air-lib/air-parser/src/lib.rs diff --git a/crates/air-parser/src/parser/air.lalrpop b/crates/air-lib/air-parser/src/parser/air.lalrpop similarity index 100% rename from crates/air-parser/src/parser/air.lalrpop rename to crates/air-lib/air-parser/src/parser/air.lalrpop diff --git a/crates/air-parser/src/parser/air.rs b/crates/air-lib/air-parser/src/parser/air.rs similarity index 100% rename from crates/air-parser/src/parser/air.rs rename to crates/air-lib/air-parser/src/parser/air.rs diff --git a/crates/air-parser/src/parser/air_parser.rs b/crates/air-lib/air-parser/src/parser/air_parser.rs similarity index 100% rename from crates/air-parser/src/parser/air_parser.rs rename to crates/air-lib/air-parser/src/parser/air_parser.rs diff --git a/crates/air-parser/src/parser/ast.rs b/crates/air-lib/air-parser/src/parser/ast.rs similarity index 100% rename from crates/air-parser/src/parser/ast.rs rename to crates/air-lib/air-parser/src/parser/ast.rs diff --git a/crates/air-parser/src/parser/ast/impls.rs b/crates/air-lib/air-parser/src/parser/ast/impls.rs similarity index 100% rename from crates/air-parser/src/parser/ast/impls.rs rename to crates/air-lib/air-parser/src/parser/ast/impls.rs diff --git a/crates/air-parser/src/parser/ast/traits.rs b/crates/air-lib/air-parser/src/parser/ast/traits.rs similarity index 100% rename from crates/air-parser/src/parser/ast/traits.rs rename to crates/air-lib/air-parser/src/parser/ast/traits.rs diff --git a/crates/air-parser/src/parser/errors.rs b/crates/air-lib/air-parser/src/parser/errors.rs similarity index 100% rename from crates/air-parser/src/parser/errors.rs rename to crates/air-lib/air-parser/src/parser/errors.rs diff --git a/crates/air-parser/src/parser/lexer/air_lexer.rs b/crates/air-lib/air-parser/src/parser/lexer/air_lexer.rs similarity index 100% rename from crates/air-parser/src/parser/lexer/air_lexer.rs rename to crates/air-lib/air-parser/src/parser/lexer/air_lexer.rs diff --git a/crates/air-parser/src/parser/lexer/call_variable_parser.rs b/crates/air-lib/air-parser/src/parser/lexer/call_variable_parser.rs similarity index 100% rename from crates/air-parser/src/parser/lexer/call_variable_parser.rs rename to crates/air-lib/air-parser/src/parser/lexer/call_variable_parser.rs diff --git a/crates/air-parser/src/parser/lexer/errors.rs b/crates/air-lib/air-parser/src/parser/lexer/errors.rs similarity index 100% rename from crates/air-parser/src/parser/lexer/errors.rs rename to crates/air-lib/air-parser/src/parser/lexer/errors.rs diff --git a/crates/air-parser/src/parser/lexer/mod.rs b/crates/air-lib/air-parser/src/parser/lexer/mod.rs similarity index 100% rename from crates/air-parser/src/parser/lexer/mod.rs rename to crates/air-lib/air-parser/src/parser/lexer/mod.rs diff --git a/crates/air-parser/src/parser/lexer/tests.rs b/crates/air-lib/air-parser/src/parser/lexer/tests.rs similarity index 100% rename from crates/air-parser/src/parser/lexer/tests.rs rename to crates/air-lib/air-parser/src/parser/lexer/tests.rs diff --git a/crates/air-parser/src/parser/lexer/token.rs b/crates/air-lib/air-parser/src/parser/lexer/token.rs similarity index 100% rename from crates/air-parser/src/parser/lexer/token.rs rename to crates/air-lib/air-parser/src/parser/lexer/token.rs diff --git a/crates/air-parser/src/parser/lexer/token/traits.rs b/crates/air-lib/air-parser/src/parser/lexer/token/traits.rs similarity index 100% rename from crates/air-parser/src/parser/lexer/token/traits.rs rename to crates/air-lib/air-parser/src/parser/lexer/token/traits.rs diff --git a/crates/air-parser/src/parser/lexer/utils.rs b/crates/air-lib/air-parser/src/parser/lexer/utils.rs similarity index 100% rename from crates/air-parser/src/parser/lexer/utils.rs rename to crates/air-lib/air-parser/src/parser/lexer/utils.rs diff --git a/crates/air-parser/src/parser/mod.rs b/crates/air-lib/air-parser/src/parser/mod.rs similarity index 100% rename from crates/air-parser/src/parser/mod.rs rename to crates/air-lib/air-parser/src/parser/mod.rs diff --git a/crates/air-parser/src/parser/tests.rs b/crates/air-lib/air-parser/src/parser/tests.rs similarity index 100% rename from crates/air-parser/src/parser/tests.rs rename to crates/air-lib/air-parser/src/parser/tests.rs diff --git a/crates/air-parser/src/parser/validator.rs b/crates/air-lib/air-parser/src/parser/validator.rs similarity index 100% rename from crates/air-parser/src/parser/validator.rs rename to crates/air-lib/air-parser/src/parser/validator.rs diff --git a/crates/interpreter-data/CHANGELOG.md b/crates/air-lib/interpreter-data/CHANGELOG.md similarity index 100% rename from crates/interpreter-data/CHANGELOG.md rename to crates/air-lib/interpreter-data/CHANGELOG.md diff --git a/crates/interpreter-data/Cargo.toml b/crates/air-lib/interpreter-data/Cargo.toml similarity index 100% rename from crates/interpreter-data/Cargo.toml rename to crates/air-lib/interpreter-data/Cargo.toml diff --git a/crates/interpreter-data/src/executed_state.rs b/crates/air-lib/interpreter-data/src/executed_state.rs similarity index 100% rename from crates/interpreter-data/src/executed_state.rs rename to crates/air-lib/interpreter-data/src/executed_state.rs diff --git a/crates/interpreter-data/src/executed_state/impls.rs b/crates/air-lib/interpreter-data/src/executed_state/impls.rs similarity index 100% rename from crates/interpreter-data/src/executed_state/impls.rs rename to crates/air-lib/interpreter-data/src/executed_state/impls.rs diff --git a/crates/interpreter-data/src/executed_state/se_de.rs b/crates/air-lib/interpreter-data/src/executed_state/se_de.rs similarity index 100% rename from crates/interpreter-data/src/executed_state/se_de.rs rename to crates/air-lib/interpreter-data/src/executed_state/se_de.rs diff --git a/crates/interpreter-data/src/interpreter_data.rs b/crates/air-lib/interpreter-data/src/interpreter_data.rs similarity index 100% rename from crates/interpreter-data/src/interpreter_data.rs rename to crates/air-lib/interpreter-data/src/interpreter_data.rs diff --git a/crates/interpreter-data/src/lib.rs b/crates/air-lib/interpreter-data/src/lib.rs similarity index 100% rename from crates/interpreter-data/src/lib.rs rename to crates/air-lib/interpreter-data/src/lib.rs diff --git a/crates/interpreter-interface/Cargo.toml b/crates/air-lib/interpreter-interface/Cargo.toml similarity index 100% rename from crates/interpreter-interface/Cargo.toml rename to crates/air-lib/interpreter-interface/Cargo.toml diff --git a/crates/interpreter-interface/src/call_request_parameters.rs b/crates/air-lib/interpreter-interface/src/call_request_parameters.rs similarity index 100% rename from crates/interpreter-interface/src/call_request_parameters.rs rename to crates/air-lib/interpreter-interface/src/call_request_parameters.rs diff --git a/crates/interpreter-interface/src/call_service_result.rs b/crates/air-lib/interpreter-interface/src/call_service_result.rs similarity index 100% rename from crates/interpreter-interface/src/call_service_result.rs rename to crates/air-lib/interpreter-interface/src/call_service_result.rs diff --git a/crates/interpreter-interface/src/interpreter_outcome.rs b/crates/air-lib/interpreter-interface/src/interpreter_outcome.rs similarity index 100% rename from crates/interpreter-interface/src/interpreter_outcome.rs rename to crates/air-lib/interpreter-interface/src/interpreter_outcome.rs diff --git a/crates/interpreter-interface/src/lib.rs b/crates/air-lib/interpreter-interface/src/lib.rs similarity index 100% rename from crates/interpreter-interface/src/lib.rs rename to crates/air-lib/interpreter-interface/src/lib.rs diff --git a/crates/interpreter-interface/src/run_parameters.rs b/crates/air-lib/interpreter-interface/src/run_parameters.rs similarity index 100% rename from crates/interpreter-interface/src/run_parameters.rs rename to crates/air-lib/interpreter-interface/src/run_parameters.rs diff --git a/crates/air-lib/log-targets/Cargo.toml b/crates/air-lib/log-targets/Cargo.toml new file mode 100644 index 00000000..91220285 --- /dev/null +++ b/crates/air-lib/log-targets/Cargo.toml @@ -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" diff --git a/crates/air-lib/log-targets/README.md b/crates/air-lib/log-targets/README.md new file mode 100644 index 00000000..2b891d24 --- /dev/null +++ b/crates/air-lib/log-targets/README.md @@ -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. diff --git a/air/src/log_targets.rs b/crates/air-lib/log-targets/src/lib.rs similarity index 98% rename from air/src/log_targets.rs rename to crates/air-lib/log-targets/src/lib.rs index 4e98bdd0..9af400cd 100644 --- a/air/src/log_targets.rs +++ b/crates/air-lib/log-targets/src/lib.rs @@ -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. diff --git a/crates/polyplets/Cargo.toml b/crates/air-lib/polyplets/Cargo.toml similarity index 100% rename from crates/polyplets/Cargo.toml rename to crates/air-lib/polyplets/Cargo.toml diff --git a/crates/polyplets/src/lib.rs b/crates/air-lib/polyplets/src/lib.rs similarity index 100% rename from crates/polyplets/src/lib.rs rename to crates/air-lib/polyplets/src/lib.rs diff --git a/crates/polyplets/src/tetraplet.rs b/crates/air-lib/polyplets/src/tetraplet.rs similarity index 100% rename from crates/polyplets/src/tetraplet.rs rename to crates/air-lib/polyplets/src/tetraplet.rs diff --git a/crates/polyplets/src/triplet.rs b/crates/air-lib/polyplets/src/triplet.rs similarity index 100% rename from crates/polyplets/src/triplet.rs rename to crates/air-lib/polyplets/src/triplet.rs diff --git a/crates/test-utils/Cargo.toml b/crates/air-lib/test-utils/Cargo.toml similarity index 62% rename from crates/test-utils/Cargo.toml rename to crates/air-lib/test-utils/Cargo.toml index 5f1b2734..b322842a 100644 --- a/crates/test-utils/Cargo.toml +++ b/crates/air-lib/test-utils/Cargo.toml @@ -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" diff --git a/crates/test-utils/src/call_services.rs b/crates/air-lib/test-utils/src/call_services.rs similarity index 100% rename from crates/test-utils/src/call_services.rs rename to crates/air-lib/test-utils/src/call_services.rs diff --git a/crates/test-utils/src/executed_state.rs b/crates/air-lib/test-utils/src/executed_state.rs similarity index 100% rename from crates/test-utils/src/executed_state.rs rename to crates/air-lib/test-utils/src/executed_state.rs diff --git a/crates/test-utils/src/lib.rs b/crates/air-lib/test-utils/src/lib.rs similarity index 100% rename from crates/test-utils/src/lib.rs rename to crates/air-lib/test-utils/src/lib.rs diff --git a/crates/test-utils/src/test_runner.rs b/crates/air-lib/test-utils/src/test_runner.rs similarity index 100% rename from crates/test-utils/src/test_runner.rs rename to crates/air-lib/test-utils/src/test_runner.rs diff --git a/crates/trace-handler/.rustfmt.toml b/crates/air-lib/trace-handler/.rustfmt.toml similarity index 100% rename from crates/trace-handler/.rustfmt.toml rename to crates/air-lib/trace-handler/.rustfmt.toml diff --git a/crates/trace-handler/Cargo.toml b/crates/air-lib/trace-handler/Cargo.toml similarity index 92% rename from crates/trace-handler/Cargo.toml rename to crates/air-lib/trace-handler/Cargo.toml index e5313090..79ec09ad 100644 --- a/crates/trace-handler/Cargo.toml +++ b/crates/air-lib/trace-handler/Cargo.toml @@ -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" diff --git a/crates/trace-handler/README.md b/crates/air-lib/trace-handler/README.md similarity index 84% rename from crates/trace-handler/README.md rename to crates/air-lib/trace-handler/README.md index 87cfc3e7..d73e632e 100644 --- a/crates/trace-handler/README.md +++ b/crates/air-lib/trace-handler/README.md @@ -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 diff --git a/crates/trace-handler/src/data_keeper/errors.rs b/crates/air-lib/trace-handler/src/data_keeper/errors.rs similarity index 100% rename from crates/trace-handler/src/data_keeper/errors.rs rename to crates/air-lib/trace-handler/src/data_keeper/errors.rs diff --git a/crates/trace-handler/src/data_keeper/keeper.rs b/crates/air-lib/trace-handler/src/data_keeper/keeper.rs similarity index 100% rename from crates/trace-handler/src/data_keeper/keeper.rs rename to crates/air-lib/trace-handler/src/data_keeper/keeper.rs diff --git a/crates/trace-handler/src/data_keeper/merge_ctx.rs b/crates/air-lib/trace-handler/src/data_keeper/merge_ctx.rs similarity index 100% rename from crates/trace-handler/src/data_keeper/merge_ctx.rs rename to crates/air-lib/trace-handler/src/data_keeper/merge_ctx.rs diff --git a/crates/trace-handler/src/data_keeper/mod.rs b/crates/air-lib/trace-handler/src/data_keeper/mod.rs similarity index 100% rename from crates/trace-handler/src/data_keeper/mod.rs rename to crates/air-lib/trace-handler/src/data_keeper/mod.rs diff --git a/crates/trace-handler/src/data_keeper/trace_slider.rs b/crates/air-lib/trace-handler/src/data_keeper/trace_slider.rs similarity index 100% rename from crates/trace-handler/src/data_keeper/trace_slider.rs rename to crates/air-lib/trace-handler/src/data_keeper/trace_slider.rs diff --git a/crates/trace-handler/src/errors.rs b/crates/air-lib/trace-handler/src/errors.rs similarity index 100% rename from crates/trace-handler/src/errors.rs rename to crates/air-lib/trace-handler/src/errors.rs diff --git a/crates/trace-handler/src/handler.rs b/crates/air-lib/trace-handler/src/handler.rs similarity index 98% rename from crates/trace-handler/src/handler.rs rename to crates/air-lib/trace-handler/src/handler.rs index a7302784..7efb480d 100644 --- a/crates/trace-handler/src/handler.rs +++ b/crates/air-lib/trace-handler/src/handler.rs @@ -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 ); diff --git a/crates/trace-handler/src/lib.rs b/crates/air-lib/trace-handler/src/lib.rs similarity index 95% rename from crates/trace-handler/src/lib.rs rename to crates/air-lib/trace-handler/src/lib.rs index 6f3bbbaf..6e9d34ba 100644 --- a/crates/trace-handler/src/lib.rs +++ b/crates/air-lib/trace-handler/src/lib.rs @@ -33,8 +33,6 @@ pub use state_automata::SubtreeType; pub type TraceHandlerResult = std::result::Result; -pub const EXECUTED_STATE_CHANGING: &str = "executed_state_changing"; - use air_interpreter_data::*; use data_keeper::DataKeeper; use data_keeper::MergeCtx; diff --git a/crates/trace-handler/src/merger/ap_merger.rs b/crates/air-lib/trace-handler/src/merger/ap_merger.rs similarity index 100% rename from crates/trace-handler/src/merger/ap_merger.rs rename to crates/air-lib/trace-handler/src/merger/ap_merger.rs diff --git a/crates/trace-handler/src/merger/call_merger.rs b/crates/air-lib/trace-handler/src/merger/call_merger.rs similarity index 100% rename from crates/trace-handler/src/merger/call_merger.rs rename to crates/air-lib/trace-handler/src/merger/call_merger.rs diff --git a/crates/trace-handler/src/merger/call_merger/call_result_constructor.rs b/crates/air-lib/trace-handler/src/merger/call_merger/call_result_constructor.rs similarity index 100% rename from crates/trace-handler/src/merger/call_merger/call_result_constructor.rs rename to crates/air-lib/trace-handler/src/merger/call_merger/call_result_constructor.rs diff --git a/crates/trace-handler/src/merger/call_merger/utils.rs b/crates/air-lib/trace-handler/src/merger/call_merger/utils.rs similarity index 100% rename from crates/trace-handler/src/merger/call_merger/utils.rs rename to crates/air-lib/trace-handler/src/merger/call_merger/utils.rs diff --git a/crates/trace-handler/src/merger/errors.rs b/crates/air-lib/trace-handler/src/merger/errors.rs similarity index 100% rename from crates/trace-handler/src/merger/errors.rs rename to crates/air-lib/trace-handler/src/merger/errors.rs diff --git a/crates/trace-handler/src/merger/fold_merger.rs b/crates/air-lib/trace-handler/src/merger/fold_merger.rs similarity index 100% rename from crates/trace-handler/src/merger/fold_merger.rs rename to crates/air-lib/trace-handler/src/merger/fold_merger.rs diff --git a/crates/trace-handler/src/merger/fold_merger/fold_lore_resolver.rs b/crates/air-lib/trace-handler/src/merger/fold_merger/fold_lore_resolver.rs similarity index 100% rename from crates/trace-handler/src/merger/fold_merger/fold_lore_resolver.rs rename to crates/air-lib/trace-handler/src/merger/fold_merger/fold_lore_resolver.rs diff --git a/crates/trace-handler/src/merger/mod.rs b/crates/air-lib/trace-handler/src/merger/mod.rs similarity index 100% rename from crates/trace-handler/src/merger/mod.rs rename to crates/air-lib/trace-handler/src/merger/mod.rs diff --git a/crates/trace-handler/src/merger/par_merger.rs b/crates/air-lib/trace-handler/src/merger/par_merger.rs similarity index 100% rename from crates/trace-handler/src/merger/par_merger.rs rename to crates/air-lib/trace-handler/src/merger/par_merger.rs diff --git a/crates/trace-handler/src/state_automata/errors.rs b/crates/air-lib/trace-handler/src/state_automata/errors.rs similarity index 100% rename from crates/trace-handler/src/state_automata/errors.rs rename to crates/air-lib/trace-handler/src/state_automata/errors.rs diff --git a/crates/trace-handler/src/state_automata/fold_fsm.rs b/crates/air-lib/trace-handler/src/state_automata/fold_fsm.rs similarity index 100% rename from crates/trace-handler/src/state_automata/fold_fsm.rs rename to crates/air-lib/trace-handler/src/state_automata/fold_fsm.rs diff --git a/crates/trace-handler/src/state_automata/fold_fsm/lore_applier.rs b/crates/air-lib/trace-handler/src/state_automata/fold_fsm/lore_applier.rs similarity index 100% rename from crates/trace-handler/src/state_automata/fold_fsm/lore_applier.rs rename to crates/air-lib/trace-handler/src/state_automata/fold_fsm/lore_applier.rs diff --git a/crates/trace-handler/src/state_automata/fold_fsm/lore_ctor.rs b/crates/air-lib/trace-handler/src/state_automata/fold_fsm/lore_ctor.rs similarity index 100% rename from crates/trace-handler/src/state_automata/fold_fsm/lore_ctor.rs rename to crates/air-lib/trace-handler/src/state_automata/fold_fsm/lore_ctor.rs diff --git a/crates/trace-handler/src/state_automata/fold_fsm/lore_ctor_queue.rs b/crates/air-lib/trace-handler/src/state_automata/fold_fsm/lore_ctor_queue.rs similarity index 100% rename from crates/trace-handler/src/state_automata/fold_fsm/lore_ctor_queue.rs rename to crates/air-lib/trace-handler/src/state_automata/fold_fsm/lore_ctor_queue.rs diff --git a/crates/trace-handler/src/state_automata/fold_fsm/state_handler.rs b/crates/air-lib/trace-handler/src/state_automata/fold_fsm/state_handler.rs similarity index 100% rename from crates/trace-handler/src/state_automata/fold_fsm/state_handler.rs rename to crates/air-lib/trace-handler/src/state_automata/fold_fsm/state_handler.rs diff --git a/crates/trace-handler/src/state_automata/fsm_queue.rs b/crates/air-lib/trace-handler/src/state_automata/fsm_queue.rs similarity index 100% rename from crates/trace-handler/src/state_automata/fsm_queue.rs rename to crates/air-lib/trace-handler/src/state_automata/fsm_queue.rs diff --git a/crates/trace-handler/src/state_automata/mod.rs b/crates/air-lib/trace-handler/src/state_automata/mod.rs similarity index 100% rename from crates/trace-handler/src/state_automata/mod.rs rename to crates/air-lib/trace-handler/src/state_automata/mod.rs diff --git a/crates/trace-handler/src/state_automata/par_fsm.rs b/crates/air-lib/trace-handler/src/state_automata/par_fsm.rs similarity index 100% rename from crates/trace-handler/src/state_automata/par_fsm.rs rename to crates/air-lib/trace-handler/src/state_automata/par_fsm.rs diff --git a/crates/trace-handler/src/state_automata/par_fsm/par_builder.rs b/crates/air-lib/trace-handler/src/state_automata/par_fsm/par_builder.rs similarity index 100% rename from crates/trace-handler/src/state_automata/par_fsm/par_builder.rs rename to crates/air-lib/trace-handler/src/state_automata/par_fsm/par_builder.rs diff --git a/crates/trace-handler/src/state_automata/par_fsm/state_handler.rs b/crates/air-lib/trace-handler/src/state_automata/par_fsm/state_handler.rs similarity index 100% rename from crates/trace-handler/src/state_automata/par_fsm/state_handler.rs rename to crates/air-lib/trace-handler/src/state_automata/par_fsm/state_handler.rs diff --git a/crates/trace-handler/src/state_automata/par_fsm/state_handler/new_states_calculation.rs b/crates/air-lib/trace-handler/src/state_automata/par_fsm/state_handler/new_states_calculation.rs similarity index 100% rename from crates/trace-handler/src/state_automata/par_fsm/state_handler/new_states_calculation.rs rename to crates/air-lib/trace-handler/src/state_automata/par_fsm/state_handler/new_states_calculation.rs diff --git a/crates/trace-handler/src/state_automata/state_inserter.rs b/crates/air-lib/trace-handler/src/state_automata/state_inserter.rs similarity index 100% rename from crates/trace-handler/src/state_automata/state_inserter.rs rename to crates/air-lib/trace-handler/src/state_automata/state_inserter.rs diff --git a/crates/trace-handler/src/state_automata/utils.rs b/crates/air-lib/trace-handler/src/state_automata/utils.rs similarity index 100% rename from crates/trace-handler/src/state_automata/utils.rs rename to crates/air-lib/trace-handler/src/state_automata/utils.rs