Skip to content
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

refactor: Merge log_manager crate under tedge_log_manager #3215

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 6 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 0 additions & 29 deletions crates/common/log_manager/Cargo.toml

This file was deleted.

8 changes: 7 additions & 1 deletion crates/extensions/tedge_log_manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ repository = { workspace = true }
[dependencies]
async-trait = { workspace = true }
camino = { workspace = true }
easy_reader = { workspace = true }
glob = { workspace = true }
log = { workspace = true }
log_manager = { workspace = true }
rand = { workspace = true }
regex = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
tedge_actors = { workspace = true }
tedge_api = { workspace = true }
Expand All @@ -23,6 +27,7 @@ tedge_mqtt_ext = { workspace = true }
tedge_uploader_ext = { workspace = true }
tedge_utils = { workspace = true }
thiserror = { workspace = true }
time = { workspace = true, features = ["formatting"] }
tokio = { workspace = true, features = ["macros"] }
toml = { workspace = true }

Expand All @@ -32,6 +37,7 @@ assert-json-diff = { workspace = true }
filetime = { workspace = true }
tedge_actors = { workspace = true, features = ["test-helpers"] }
tedge_test_utils = { workspace = true }
time = { workspace = true, features = ["macros"] }

[lints]
workspace = true
4 changes: 2 additions & 2 deletions crates/extensions/tedge_log_manager/src/actor.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use std::collections::HashMap;

use crate::manager::LogPluginConfig;
use async_trait::async_trait;
use camino::Utf8Path;
use log::debug;
use log::error;
use log::info;
use log::warn;
use log_manager::LogPluginConfig;
use tedge_actors::fan_in_message_type;
use tedge_actors::Actor;
use tedge_actors::ChannelError;
Expand Down Expand Up @@ -156,7 +156,7 @@ impl LogManagerActor {
) -> Result<(), LogManagementError> {
let topic = request.topic(&self.config.mqtt_schema).as_ref().to_string();
let request = &request.payload;
let log_path = log_manager::new_read_logs(
let log_path = crate::manager::new_read_logs(
&self.plugin_config.files,
&request.log_type,
request.date_from,
Expand Down
2 changes: 1 addition & 1 deletion crates/extensions/tedge_log_manager/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub enum LogManagementError {
FromPathsError(#[from] tedge_utils::paths::PathsError),

#[error(transparent)]
FromLogRetrievalError(#[from] log_manager::LogRetrievalError),
FromLogRetrievalError(#[from] crate::manager::LogRetrievalError),
}

impl From<LogManagementError> for tedge_actors::RuntimeError {
Expand Down
3 changes: 2 additions & 1 deletion crates/extensions/tedge_log_manager/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
mod actor;
mod config;
mod error;
mod manager;

#[cfg(test)]
mod tests;

pub use actor::*;
pub use config::*;
use log::error;
use log_manager::LogPluginConfig;
use manager::LogPluginConfig;
use std::path::PathBuf;
use tedge_actors::Builder;
use tedge_actors::CloneSender;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ mod tests {
use std::io::Write;

use super::*;
use crate::FileEntry;
use crate::manager::FileEntry;
use filetime::set_file_mtime;
use filetime::FileTime;
use tedge_test_utils::fs::TempTedgeDir;
Expand Down