From d1904bda90f7b26cd3f4289288784ab51cf80d67 Mon Sep 17 00:00:00 2001 From: Phoeniix Zhao Date: Thu, 16 May 2024 17:01:15 +0800 Subject: [PATCH] refactor: modify modules' name to meet the clippy lint Signed-off-by: Phoeniix Zhao --- crates/benchmark/src/runner.rs | 2 +- crates/curp-test-utils/src/test_cmd.rs | 2 +- crates/curp/src/client/mod.rs | 2 +- crates/curp/src/server/cmd_worker/mod.rs | 2 +- crates/curp/src/server/curp_node.rs | 2 +- crates/curp/src/server/mod.rs | 2 +- crates/curp/src/server/raw_curp/log.rs | 2 +- crates/curp/src/server/raw_curp/mod.rs | 2 +- crates/curp/src/server/raw_curp/tests.rs | 2 +- crates/curp/src/server/storage/db.rs | 2 +- crates/curp/tests/it/common/curp_group.rs | 8 ++-- crates/curp/tests/it/server.rs | 2 +- crates/simulation/src/curp_group.rs | 2 +- crates/simulation/src/xline_group.rs | 4 +- .../src/config/{auth_config.rs => auth.rs} | 1 + .../config/{client_config.rs => client.rs} | 0 .../config/{cluster_config.rs => cluster.rs} | 3 +- .../config/{compact_config.rs => compact.rs} | 1 + .../src/config/{curp_config.rs => curp.rs} | 2 +- .../config/{engine_config.rs => engine.rs} | 0 .../src/config/{log_config.rs => log.rs} | 0 .../config/{metrics_config.rs => metrics.rs} | 2 + crates/utils/src/config/mod.rs | 45 +++++++++---------- .../config/{server_config.rs => server.rs} | 1 + .../config/{storage_config.rs => storage.rs} | 2 +- .../src/config/{tls_config.rs => tls.rs} | 0 .../src/config/{trace_config.rs => trace.rs} | 2 +- crates/utils/src/parser.rs | 6 +-- crates/xline-client/src/lib.rs | 2 +- crates/xline-test-utils/src/lib.rs | 18 ++++---- crates/xline/src/server/maintenance.rs | 2 +- crates/xline/src/server/watch_server.rs | 4 +- crates/xline/src/server/xline_server.rs | 12 ++--- crates/xline/src/storage/auth_store/store.rs | 2 +- crates/xline/src/storage/compact/mod.rs | 2 +- crates/xline/src/storage/db.rs | 2 +- crates/xline/src/storage/kv_store.rs | 2 +- crates/xline/src/storage/kvwatcher.rs | 2 +- crates/xline/src/storage/lease_store/mod.rs | 2 +- crates/xline/src/utils/args.rs | 24 +++++----- crates/xline/src/utils/metrics.rs | 2 +- crates/xline/src/utils/trace.rs | 4 +- crates/xline/tests/it/auth_test.rs | 6 +-- crates/xline/tests/it/tls_test.rs | 6 +-- crates/xlinectl/src/main.rs | 2 +- 45 files changed, 99 insertions(+), 96 deletions(-) rename crates/utils/src/config/{auth_config.rs => auth.rs} (97%) rename crates/utils/src/config/{client_config.rs => client.rs} (100%) rename crates/utils/src/config/{cluster_config.rs => cluster.rs} (97%) rename crates/utils/src/config/{compact_config.rs => compact.rs} (99%) rename crates/utils/src/config/{curp_config.rs => curp.rs} (99%) rename crates/utils/src/config/{engine_config.rs => engine.rs} (100%) rename crates/utils/src/config/{log_config.rs => log.rs} (100%) rename crates/utils/src/config/{metrics_config.rs => metrics.rs} (98%) rename crates/utils/src/config/{server_config.rs => server.rs} (98%) rename crates/utils/src/config/{storage_config.rs => storage.rs} (94%) rename crates/utils/src/config/{tls_config.rs => tls.rs} (100%) rename crates/utils/src/config/{trace_config.rs => trace.rs} (95%) diff --git a/crates/benchmark/src/runner.rs b/crates/benchmark/src/runner.rs index eb8924008..e62552a6d 100644 --- a/crates/benchmark/src/runner.rs +++ b/crates/benchmark/src/runner.rs @@ -19,7 +19,7 @@ use tokio::{ time::{Duration, Instant}, }; use tracing::debug; -use utils::config::client_config::ClientConfig; +use utils::config::client::ClientConfig; use xline_client::{types::kv::PutRequest, ClientOptions}; use crate::{args::Commands, bench_client::BenchClient, Benchmark}; diff --git a/crates/curp-test-utils/src/test_cmd.rs b/crates/curp-test-utils/src/test_cmd.rs index 0aa8979de..2674c2046 100644 --- a/crates/curp-test-utils/src/test_cmd.rs +++ b/crates/curp-test-utils/src/test_cmd.rs @@ -18,7 +18,7 @@ use serde::{Deserialize, Serialize}; use thiserror::Error; use tokio::{sync::mpsc, time::sleep}; use tracing::debug; -use utils::config::engine_config::EngineConfig; +use utils::config::engine::EngineConfig; use crate::{META_TABLE, REVISION_TABLE, TEST_TABLE}; diff --git a/crates/curp/src/client/mod.rs b/crates/curp/src/client/mod.rs index 87d990893..88d925a9b 100644 --- a/crates/curp/src/client/mod.rs +++ b/crates/curp/src/client/mod.rs @@ -32,7 +32,7 @@ use tonic::transport::ClientTlsConfig; use tracing::debug; #[cfg(madsim)] use utils::ClientTlsConfig; -use utils::{build_endpoint, config::client_config::ClientConfig}; +use utils::{build_endpoint, config::client::ClientConfig}; use self::{ retry::{Retry, RetryConfig}, diff --git a/crates/curp/src/server/cmd_worker/mod.rs b/crates/curp/src/server/cmd_worker/mod.rs index fdcd0b51c..d5023934e 100644 --- a/crates/curp/src/server/cmd_worker/mod.rs +++ b/crates/curp/src/server/cmd_worker/mod.rs @@ -422,7 +422,7 @@ mod tests { use test_macros::abort_on_panic; use tokio::{sync::mpsc, time::Instant}; use tracing_test::traced_test; - use utils::config::engine_config::EngineConfig; + use utils::config::engine::EngineConfig; use super::*; use crate::{log_entry::LogEntry, rpc::ProposeId}; diff --git a/crates/curp/src/server/curp_node.rs b/crates/curp/src/server/curp_node.rs index aecfd1b9e..d93c65dcd 100644 --- a/crates/curp/src/server/curp_node.rs +++ b/crates/curp/src/server/curp_node.rs @@ -21,7 +21,7 @@ use tracing::{debug, error, info, trace, warn}; #[cfg(madsim)] use utils::ClientTlsConfig; use utils::{ - config::curp_config::CurpConfig, + config::curp::CurpConfig, task_manager::{tasks::TaskName, Listener, State, TaskManager}, }; diff --git a/crates/curp/src/server/mod.rs b/crates/curp/src/server/mod.rs index 5b64456b3..4aed0b8de 100644 --- a/crates/curp/src/server/mod.rs +++ b/crates/curp/src/server/mod.rs @@ -7,7 +7,7 @@ use tonic::transport::ClientTlsConfig; use tracing::instrument; #[cfg(madsim)] use utils::ClientTlsConfig; -use utils::{config::curp_config::CurpConfig, task_manager::TaskManager, tracing::Extract}; +use utils::{config::curp::CurpConfig, task_manager::TaskManager, tracing::Extract}; use self::curp_node::CurpNode; pub use self::{ diff --git a/crates/curp/src/server/raw_curp/log.rs b/crates/curp/src/server/raw_curp/log.rs index be1f5ca9c..b5410b04a 100644 --- a/crates/curp/src/server/raw_curp/log.rs +++ b/crates/curp/src/server/raw_curp/log.rs @@ -455,7 +455,7 @@ mod tests { use std::{iter::repeat, ops::Index, sync::Arc}; use curp_test_utils::test_cmd::TestCommand; - use utils::config::curp_config::{default_batch_max_size, default_log_entries_cap}; + use utils::config::curp::{default_batch_max_size, default_log_entries_cap}; use super::*; diff --git a/crates/curp/src/server/raw_curp/mod.rs b/crates/curp/src/server/raw_curp/mod.rs index 278e512f3..76a0fd658 100644 --- a/crates/curp/src/server/raw_curp/mod.rs +++ b/crates/curp/src/server/raw_curp/mod.rs @@ -37,7 +37,7 @@ use tracing::{ #[cfg(madsim)] use utils::ClientTlsConfig; use utils::{ - config::curp_config::CurpConfig, + config::curp::CurpConfig, parking_lot_lock::{MutexMap, RwLockMap}, task_manager::TaskManager, }; diff --git a/crates/curp/src/server/raw_curp/tests.rs b/crates/curp/src/server/raw_curp/tests.rs index 8eaeff9d8..703a5d361 100644 --- a/crates/curp/src/server/raw_curp/tests.rs +++ b/crates/curp/src/server/raw_curp/tests.rs @@ -7,7 +7,7 @@ use tokio::{ time::{sleep, Instant}, }; use tracing_test::traced_test; -use utils::config::curp_config::{ +use utils::config::curp::{ default_candidate_timeout_ticks, default_follower_timeout_ticks, default_heartbeat_interval, CurpConfigBuilder, }; diff --git a/crates/curp/src/server/storage/db.rs b/crates/curp/src/server/storage/db.rs index 2319d9580..a8e9cd2b9 100644 --- a/crates/curp/src/server/storage/db.rs +++ b/crates/curp/src/server/storage/db.rs @@ -3,7 +3,7 @@ use std::marker::PhantomData; use async_trait::async_trait; use engine::{Engine, EngineType, StorageEngine, WriteOperation}; use prost::Message; -use utils::config::engine_config::EngineConfig; +use utils::config::engine::EngineConfig; use super::{StorageApi, StorageError}; use crate::{ diff --git a/crates/curp/tests/it/common/curp_group.rs b/crates/curp/tests/it/common/curp_group.rs index 2b370e71a..188b5cc42 100644 --- a/crates/curp/tests/it/common/curp_group.rs +++ b/crates/curp/tests/it/common/curp_group.rs @@ -39,10 +39,10 @@ use tracing::debug; use utils::{ build_endpoint, config::{ - client_config::ClientConfig, - curp_config::{CurpConfig, CurpConfigBuilder}, - engine_config::EngineConfig, - storage_config::{default_quota, StorageConfig}, + client::ClientConfig, + curp::{CurpConfig, CurpConfigBuilder}, + engine::EngineConfig, + storage::{default_quota, StorageConfig}, }, task_manager::{tasks::TaskName, Listener, TaskManager}, }; diff --git a/crates/curp/tests/it/server.rs b/crates/curp/tests/it/server.rs index 817c6160b..b23b1b6e6 100644 --- a/crates/curp/tests/it/server.rs +++ b/crates/curp/tests/it/server.rs @@ -15,7 +15,7 @@ use curp_test_utils::{ use madsim::rand::{thread_rng, Rng}; use test_macros::abort_on_panic; use tokio::net::TcpListener; -use utils::{config::client_config::ClientConfig, timestamp}; +use utils::{config::client::ClientConfig, timestamp}; use crate::common::curp_group::{ commandpb::ProposeId, CurpGroup, FetchClusterRequest, ProposeRequest, ProposeResponse, diff --git a/crates/simulation/src/curp_group.rs b/crates/simulation/src/curp_group.rs index ebca5fa2b..01f629e8e 100644 --- a/crates/simulation/src/curp_group.rs +++ b/crates/simulation/src/curp_group.rs @@ -29,7 +29,7 @@ use parking_lot::Mutex; use tokio::sync::mpsc; use tracing::debug; use utils::{ - config::{ClientConfig, CurpConfigBuilder, EngineConfig}, + config::{client::ClientConfig, curp::CurpConfigBuilder, engine::EngineConfig}, task_manager::TaskManager, }; diff --git a/crates/simulation/src/xline_group.rs b/crates/simulation/src/xline_group.rs index 9943400dd..d6c8cf982 100644 --- a/crates/simulation/src/xline_group.rs +++ b/crates/simulation/src/xline_group.rs @@ -5,8 +5,8 @@ use madsim::runtime::NodeHandle; use tonic::transport::Channel; use tracing::debug; use utils::config::{ - AuthConfig, ClientConfig, ClusterConfig, CompactConfig, CurpConfig, InitialClusterState, - ServerTimeout, StorageConfig, TlsConfig, + auth::AuthConfig, client::ClientConfig, compact::CompactConfig, curp::CurpConfig, cluster::{InitialClusterState, ClusterConfig}, + server::ServerTimeout, storage::StorageConfig, tls::TlsConfig, }; use xline::server::XlineServer; use xline_client::{ diff --git a/crates/utils/src/config/auth_config.rs b/crates/utils/src/config/auth.rs similarity index 97% rename from crates/utils/src/config/auth_config.rs rename to crates/utils/src/config/auth.rs index 2ec2f6f75..b8bbc1989 100644 --- a/crates/utils/src/config/auth_config.rs +++ b/crates/utils/src/config/auth.rs @@ -5,6 +5,7 @@ use serde::Deserialize; /// Xline auth configuration object #[allow(clippy::module_name_repetitions)] +#[non_exhaustive] #[derive(Clone, Debug, Deserialize, PartialEq, Eq, Getters, Default)] pub struct AuthConfig { /// The public key file diff --git a/crates/utils/src/config/client_config.rs b/crates/utils/src/config/client.rs similarity index 100% rename from crates/utils/src/config/client_config.rs rename to crates/utils/src/config/client.rs diff --git a/crates/utils/src/config/cluster_config.rs b/crates/utils/src/config/cluster.rs similarity index 97% rename from crates/utils/src/config/cluster_config.rs rename to crates/utils/src/config/cluster.rs index 064aa1d77..62f2fca95 100644 --- a/crates/utils/src/config/cluster_config.rs +++ b/crates/utils/src/config/cluster.rs @@ -3,7 +3,7 @@ use std::collections::HashMap; use getset::Getters; use serde::Deserialize; -use super::{client_config::ClientConfig, curp_config::CurpConfig, server_config::ServerTimeout}; +use super::{client::ClientConfig, curp::CurpConfig, server::ServerTimeout}; /// Cluster configuration object, including cluster relevant configuration fields #[allow(clippy::module_name_repetitions)] @@ -105,6 +105,7 @@ impl ClusterConfig { } /// Cluster Range type alias +#[allow(clippy::module_name_repetitions)] pub type ClusterRange = std::ops::Range; /// Initial cluster state of xline server diff --git a/crates/utils/src/config/compact_config.rs b/crates/utils/src/config/compact.rs similarity index 99% rename from crates/utils/src/config/compact_config.rs rename to crates/utils/src/config/compact.rs index 08e6145e8..8fcea72b3 100644 --- a/crates/utils/src/config/compact_config.rs +++ b/crates/utils/src/config/compact.rs @@ -6,6 +6,7 @@ use serde::Deserialize; /// Compaction configuration #[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq, Getters)] #[allow(clippy::module_name_repetitions)] +#[non_exhaustive] pub struct CompactConfig { /// The max number of historical versions processed in a single compact operation #[getset(get = "pub")] diff --git a/crates/utils/src/config/curp_config.rs b/crates/utils/src/config/curp.rs similarity index 99% rename from crates/utils/src/config/curp_config.rs rename to crates/utils/src/config/curp.rs index 120cb2321..e4b234e87 100644 --- a/crates/utils/src/config/curp_config.rs +++ b/crates/utils/src/config/curp.rs @@ -4,7 +4,7 @@ use derive_builder::Builder; use getset::Getters; use serde::Deserialize; -use super::engine_config::EngineConfig; +use super::engine::EngineConfig; /// Curp server timeout settings #[derive(Clone, Debug, Deserialize, PartialEq, Eq, Getters, Builder)] diff --git a/crates/utils/src/config/engine_config.rs b/crates/utils/src/config/engine.rs similarity index 100% rename from crates/utils/src/config/engine_config.rs rename to crates/utils/src/config/engine.rs diff --git a/crates/utils/src/config/log_config.rs b/crates/utils/src/config/log.rs similarity index 100% rename from crates/utils/src/config/log_config.rs rename to crates/utils/src/config/log.rs diff --git a/crates/utils/src/config/metrics_config.rs b/crates/utils/src/config/metrics.rs similarity index 98% rename from crates/utils/src/config/metrics_config.rs rename to crates/utils/src/config/metrics.rs index ec10cb8f8..614451791 100644 --- a/crates/utils/src/config/metrics_config.rs +++ b/crates/utils/src/config/metrics.rs @@ -4,6 +4,7 @@ use serde::Deserialize; /// Xline metrics configuration object #[allow(clippy::module_name_repetitions)] #[derive(Clone, Debug, Deserialize, PartialEq, Eq, Getters)] +#[non_exhaustive] pub struct MetricsConfig { /// Enable or not #[getset(get = "pub")] @@ -114,6 +115,7 @@ pub fn default_metrics_push_endpoint() -> String { #[non_exhaustive] #[derive(Copy, Clone, Debug, Deserialize, PartialEq, Eq, Default)] #[serde(rename_all(deserialize = "lowercase"))] +#[allow(clippy::module_name_repetitions)] pub enum MetricsPushProtocol { /// HTTP protocol HTTP, diff --git a/crates/utils/src/config/mod.rs b/crates/utils/src/config/mod.rs index eb21c7c34..8c4e57a99 100644 --- a/crates/utils/src/config/mod.rs +++ b/crates/utils/src/config/mod.rs @@ -1,35 +1,34 @@ /// Xline auth configuration module -pub mod auth_config; +pub mod auth; /// Curp client module -pub mod client_config; +pub mod client; /// Cluster configuration module -pub mod cluster_config; +pub mod cluster; /// Compaction configuration module -pub mod compact_config; +pub mod compact; /// Curp server module -pub mod curp_config; +pub mod curp; /// Engine Configuration module -pub mod engine_config; +pub mod engine; /// Log configuration module -pub mod log_config; +pub mod log; /// Xline metrics configuration module -pub mod metrics_config; +pub mod metrics; /// Xline server module -pub mod server_config; +pub mod server; /// Storage Configuration module -pub mod storage_config; +pub mod storage; /// Xline tls configuration module -pub mod tls_config; +pub mod tls; /// Xline tracing configuration module -pub mod trace_config; +pub mod trace; use getset::Getters; use serde::Deserialize; use crate::config::{ - auth_config::AuthConfig, cluster_config::ClusterConfig, compact_config::CompactConfig, - log_config::LogConfig, metrics_config::MetricsConfig, storage_config::StorageConfig, - tls_config::TlsConfig, trace_config::TraceConfig, + auth::AuthConfig, cluster::ClusterConfig, compact::CompactConfig, log::LogConfig, + metrics::MetricsConfig, storage::StorageConfig, tls::TlsConfig, trace::TraceConfig, }; /// Xline server configuration object @@ -98,15 +97,15 @@ mod tests { use super::*; use crate::{ config::{ - client_config::{ + client::{ default_client_id_keep_alive_interval, default_client_wait_synced_timeout, default_fixed_backoff, default_propose_timeout, default_retry_count, ClientConfig, }, - compact_config::AutoCompactConfig, - curp_config::CurpConfigBuilder, - engine_config::EngineConfig, - server_config::ServerTimeout, - storage_config::default_quota, + compact::AutoCompactConfig, + curp::CurpConfigBuilder, + engine::EngineConfig, + server::ServerTimeout, + storage::default_quota, }, InitialClusterState, LevelConfig, MetricsPushProtocol, RotationConfig, }; @@ -301,7 +300,7 @@ mod tests { } #[test] - fn test_xline_server_default_config_should_be_loaded() { + fn test_xline_server_default_should_be_loaded() { let config: XlineServerConfig = toml::from_str( "[cluster] name = 'node1' @@ -390,7 +389,7 @@ mod tests { } #[test] - fn test_auto_revision_compactor_config_should_be_loaded() { + fn test_auto_revision_compactor_should_be_loaded() { let config: XlineServerConfig = toml::from_str( "[cluster] name = 'node1' diff --git a/crates/utils/src/config/server_config.rs b/crates/utils/src/config/server.rs similarity index 98% rename from crates/utils/src/config/server_config.rs rename to crates/utils/src/config/server.rs index dd158365b..4cf9e5424 100644 --- a/crates/utils/src/config/server_config.rs +++ b/crates/utils/src/config/server.rs @@ -5,6 +5,7 @@ use serde::Deserialize; /// Xline server settings #[derive(Copy, Clone, Debug, Deserialize, PartialEq, Eq, Getters)] +#[allow(clippy::module_name_repetitions)] pub struct ServerTimeout { /// Range request retry timeout settings #[getset(get = "pub")] diff --git a/crates/utils/src/config/storage_config.rs b/crates/utils/src/config/storage.rs similarity index 94% rename from crates/utils/src/config/storage_config.rs rename to crates/utils/src/config/storage.rs index 74442d565..9466d7f39 100644 --- a/crates/utils/src/config/storage_config.rs +++ b/crates/utils/src/config/storage.rs @@ -1,6 +1,6 @@ use serde::Deserialize; -use crate::config::engine_config::EngineConfig; +use crate::config::engine::EngineConfig; /// Storage Configuration #[derive(Debug, Clone, Deserialize, PartialEq, Eq)] diff --git a/crates/utils/src/config/tls_config.rs b/crates/utils/src/config/tls.rs similarity index 100% rename from crates/utils/src/config/tls_config.rs rename to crates/utils/src/config/tls.rs diff --git a/crates/utils/src/config/trace_config.rs b/crates/utils/src/config/trace.rs similarity index 95% rename from crates/utils/src/config/trace_config.rs rename to crates/utils/src/config/trace.rs index 866941935..7e44f9ca8 100644 --- a/crates/utils/src/config/trace_config.rs +++ b/crates/utils/src/config/trace.rs @@ -3,7 +3,7 @@ use std::path::PathBuf; use getset::Getters; use serde::Deserialize; -use super::log_config::{default_log_level, level_format, LevelConfig}; +use super::log::{default_log_level, level_format, LevelConfig}; /// Xline tracing configuration object #[allow(clippy::module_name_repetitions)] diff --git a/crates/utils/src/parser.rs b/crates/utils/src/parser.rs index 5442066a7..bb9e1c050 100644 --- a/crates/utils/src/parser.rs +++ b/crates/utils/src/parser.rs @@ -4,9 +4,9 @@ use clippy_utilities::OverflowArithmetic; use thiserror::Error; pub use crate::config::{ - cluster_config::{ClusterRange, InitialClusterState}, - log_config::{LevelConfig, RotationConfig}, - metrics_config::MetricsPushProtocol, + cluster::{ClusterRange, InitialClusterState}, + log::{LevelConfig, RotationConfig}, + metrics::MetricsPushProtocol, }; /// seconds per minute diff --git a/crates/xline-client/src/lib.rs b/crates/xline-client/src/lib.rs index a65372da2..b29ab2e58 100644 --- a/crates/xline-client/src/lib.rs +++ b/crates/xline-client/src/lib.rs @@ -174,7 +174,7 @@ use tonic::transport::ClientTlsConfig; use tower::Service; #[cfg(madsim)] use utils::ClientTlsConfig; -use utils::{build_endpoint, config::client_config::ClientConfig}; +use utils::{build_endpoint, config::client::ClientConfig}; use xlineapi::command::{Command, CurpClient}; use crate::{ diff --git a/crates/xline-test-utils/src/lib.rs b/crates/xline-test-utils/src/lib.rs index 33b9f04f0..d0fa9aadc 100644 --- a/crates/xline-test-utils/src/lib.rs +++ b/crates/xline-test-utils/src/lib.rs @@ -10,15 +10,15 @@ use tokio::{ }; use tonic::transport::ClientTlsConfig; use utils::config::{ - auth_config::AuthConfig, - cluster_config::{ClusterConfig, InitialClusterState}, - compact_config::CompactConfig, - engine_config::EngineConfig, - log_config::LogConfig, - metrics_config::MetricsConfig, - storage_config::{default_quota, StorageConfig}, - tls_config::TlsConfig, - trace_config::TraceConfig, + auth::AuthConfig, + cluster::{ClusterConfig, InitialClusterState}, + compact::CompactConfig, + engine::EngineConfig, + log::LogConfig, + metrics::MetricsConfig, + storage::{default_quota, StorageConfig}, + tls::TlsConfig, + trace::TraceConfig, XlineServerConfig, }; use xline::server::XlineServer; diff --git a/crates/xline/src/server/maintenance.rs b/crates/xline/src/server/maintenance.rs index cb8a44017..4b8eac235 100644 --- a/crates/xline/src/server/maintenance.rs +++ b/crates/xline/src/server/maintenance.rs @@ -288,7 +288,7 @@ mod test { use test_macros::abort_on_panic; use tokio_stream::StreamExt; - use utils::config::engine_config::EngineConfig; + use utils::config::engine::EngineConfig; use super::*; use crate::storage::db::DB; diff --git a/crates/xline/src/server/watch_server.rs b/crates/xline/src/server/watch_server.rs index 7155ec03a..288fe27ef 100644 --- a/crates/xline/src/server/watch_server.rs +++ b/crates/xline/src/server/watch_server.rs @@ -435,9 +435,7 @@ mod test { sync::mpsc, time::{sleep, timeout}, }; - use utils::config::{ - engine_config::EngineConfig, server_config::default_watch_progress_notify_interval, - }; + use utils::config::{engine::EngineConfig, server::default_watch_progress_notify_interval}; use xlineapi::RequestWrapper; use super::*; diff --git a/crates/xline/src/server/xline_server.rs b/crates/xline/src/server/xline_server.rs index 70c829316..3f44d4f8b 100644 --- a/crates/xline/src/server/xline_server.rs +++ b/crates/xline/src/server/xline_server.rs @@ -24,12 +24,12 @@ use tonic::transport::{server::Router, Server}; use tracing::{info, warn}; use utils::{ config::{ - auth_config::AuthConfig, - cluster_config::{ClusterConfig, InitialClusterState}, - compact_config::CompactConfig, - engine_config::EngineConfig, - storage_config::StorageConfig, - tls_config::TlsConfig, + auth::AuthConfig, + cluster::{ClusterConfig, InitialClusterState}, + compact::CompactConfig, + engine::EngineConfig, + storage::StorageConfig, + tls::TlsConfig, }, task_manager::{tasks::TaskName, TaskManager}, }; diff --git a/crates/xline/src/storage/auth_store/store.rs b/crates/xline/src/storage/auth_store/store.rs index 0d15edd9d..f86257324 100644 --- a/crates/xline/src/storage/auth_store/store.rs +++ b/crates/xline/src/storage/auth_store/store.rs @@ -1173,7 +1173,7 @@ mod test { use std::collections::HashMap; use merged_range::MergedRange; - use utils::config::engine_config::EngineConfig; + use utils::config::engine::EngineConfig; use super::*; use crate::{ diff --git a/crates/xline/src/storage/compact/mod.rs b/crates/xline/src/storage/compact/mod.rs index 083e97b7f..48541fa0c 100644 --- a/crates/xline/src/storage/compact/mod.rs +++ b/crates/xline/src/storage/compact/mod.rs @@ -7,7 +7,7 @@ use periodic_compactor::PeriodicCompactor; use revision_compactor::RevisionCompactor; use tokio::{sync::mpsc::Receiver, time::sleep}; use utils::{ - config::compact_config::AutoCompactConfig, + config::compact::AutoCompactConfig, task_manager::{tasks::TaskName, Listener, TaskManager}, }; use xlineapi::{command::Command, execute_error::ExecuteError, RequestWrapper}; diff --git a/crates/xline/src/storage/db.rs b/crates/xline/src/storage/db.rs index ceeb9b27d..8ebc54b6f 100644 --- a/crates/xline/src/storage/db.rs +++ b/crates/xline/src/storage/db.rs @@ -3,7 +3,7 @@ use std::{collections::HashMap, path::Path, sync::Arc}; use engine::{Engine, EngineType, Snapshot, StorageEngine, WriteOperation}; use prost::Message; use utils::{ - config::engine_config::EngineConfig, + config::engine::EngineConfig, table_names::{ ALARM_TABLE, AUTH_TABLE, KV_TABLE, LEASE_TABLE, META_TABLE, ROLE_TABLE, USER_TABLE, XLINE_TABLES, diff --git a/crates/xline/src/storage/kv_store.rs b/crates/xline/src/storage/kv_store.rs index 83cf979c3..57f826e01 100644 --- a/crates/xline/src/storage/kv_store.rs +++ b/crates/xline/src/storage/kv_store.rs @@ -928,7 +928,7 @@ mod test { use test_macros::abort_on_panic; use tokio::{runtime::Handle, task::block_in_place}; use utils::{ - config::engine_config::EngineConfig, + config::engine::EngineConfig, task_manager::{tasks::TaskName, TaskManager}, }; diff --git a/crates/xline/src/storage/kvwatcher.rs b/crates/xline/src/storage/kvwatcher.rs index ec8dfd1c9..f545bac18 100644 --- a/crates/xline/src/storage/kvwatcher.rs +++ b/crates/xline/src/storage/kvwatcher.rs @@ -604,7 +604,7 @@ mod test { use clippy_utilities::{NumericCast, OverflowArithmetic}; use test_macros::abort_on_panic; use tokio::time::{sleep, timeout}; - use utils::config::engine_config::EngineConfig; + use utils::config::engine::EngineConfig; use xlineapi::RequestWrapper; use super::*; diff --git a/crates/xline/src/storage/lease_store/mod.rs b/crates/xline/src/storage/lease_store/mod.rs index d1d272a68..051aeb478 100644 --- a/crates/xline/src/storage/lease_store/mod.rs +++ b/crates/xline/src/storage/lease_store/mod.rs @@ -373,7 +373,7 @@ mod test { use std::{error::Error, time::Duration}; use test_macros::abort_on_panic; - use utils::config::engine_config::EngineConfig; + use utils::config::engine::EngineConfig; use super::*; use crate::storage::db::DB; diff --git a/crates/xline/src/utils/args.rs b/crates/xline/src/utils/args.rs index a2e82f4ea..c7ea409b3 100644 --- a/crates/xline/src/utils/args.rs +++ b/crates/xline/src/utils/args.rs @@ -5,37 +5,37 @@ use clap::Parser; use tokio::fs; use utils::{ config::{ - auth_config::AuthConfig, - client_config::{ + auth::AuthConfig, + client::{ default_client_id_keep_alive_interval, default_client_wait_synced_timeout, default_initial_retry_timeout, default_max_retry_timeout, default_propose_timeout, default_retry_count, ClientConfig, }, - cluster_config::{ClusterConfig, InitialClusterState}, - compact_config::{ + cluster::{ClusterConfig, InitialClusterState}, + compact::{ default_compact_batch_size, default_compact_sleep_interval, AutoCompactConfig, CompactConfig, }, - curp_config::{ + curp::{ default_batch_max_size, default_batch_timeout, default_candidate_timeout_ticks, default_cmd_workers, default_follower_timeout_ticks, default_gc_interval, default_heartbeat_interval, default_log_entries_cap, default_rpc_timeout, default_server_wait_synced_timeout, CurpConfigBuilder, }, - engine_config::EngineConfig, - log_config::{default_log_level, default_rotation, LevelConfig, LogConfig, RotationConfig}, - metrics_config::{ + engine::EngineConfig, + log::{default_log_level, default_rotation, LevelConfig, LogConfig, RotationConfig}, + metrics::{ default_metrics_enable, default_metrics_path, default_metrics_port, default_metrics_push_endpoint, default_metrics_push_protocol, MetricsConfig, MetricsPushProtocol, }, - server_config::{ + server::{ default_compact_timeout, default_range_retry_timeout, default_sync_victims_interval, default_watch_progress_notify_interval, ServerTimeout, }, - storage_config::{default_quota, StorageConfig}, - tls_config::TlsConfig, - trace_config::TraceConfig, + storage::{default_quota, StorageConfig}, + tls::TlsConfig, + trace::TraceConfig, XlineServerConfig, }, parse_batch_bytes, parse_duration, parse_log_level, parse_members, parse_metrics_push_protocol, diff --git a/crates/xline/src/utils/metrics.rs b/crates/xline/src/utils/metrics.rs index 37c30cbce..7d4af693e 100644 --- a/crates/xline/src/utils/metrics.rs +++ b/crates/xline/src/utils/metrics.rs @@ -2,7 +2,7 @@ use opentelemetry::global; use opentelemetry_otlp::WithExportConfig; use opentelemetry_sdk::{metrics::SdkMeterProvider, runtime::Tokio}; use tracing::info; -use utils::config::metrics_config::{MetricsConfig, MetricsPushProtocol}; +use utils::config::metrics::{MetricsConfig, MetricsPushProtocol}; /// Start metrics server /// # Errors diff --git a/crates/xline/src/utils/trace.rs b/crates/xline/src/utils/trace.rs index 85435dd7c..c2e196fa5 100644 --- a/crates/xline/src/utils/trace.rs +++ b/crates/xline/src/utils/trace.rs @@ -4,8 +4,8 @@ use opentelemetry_sdk::runtime::Tokio; use tracing_appender::non_blocking::WorkerGuard; use tracing_subscriber::{fmt::format, layer::SubscriberExt, util::SubscriberInitExt, Layer}; use utils::config::{ - log_config::{file_appender, LogConfig}, - trace_config::TraceConfig, + log::{file_appender, LogConfig}, + trace::TraceConfig, }; /// init tracing subscriber diff --git a/crates/xline/tests/it/auth_test.rs b/crates/xline/tests/it/auth_test.rs index 44c678ab0..24588fdaf 100644 --- a/crates/xline/tests/it/auth_test.rs +++ b/crates/xline/tests/it/auth_test.rs @@ -2,9 +2,9 @@ use std::{error::Error, iter, path::PathBuf}; use test_macros::abort_on_panic; use utils::config::{ - auth_config::AuthConfig, cluster_config::ClusterConfig, compact_config::CompactConfig, - log_config::LogConfig, metrics_config::MetricsConfig, storage_config::StorageConfig, - tls_config::TlsConfig, trace_config::TraceConfig, XlineServerConfig, + auth::AuthConfig, cluster::ClusterConfig, compact::CompactConfig, log::LogConfig, + metrics::MetricsConfig, storage::StorageConfig, tls::TlsConfig, trace::TraceConfig, + XlineServerConfig, }; use xline_test_utils::{ enable_auth, set_user, diff --git a/crates/xline/tests/it/tls_test.rs b/crates/xline/tests/it/tls_test.rs index ba2c036e6..5275ccaad 100644 --- a/crates/xline/tests/it/tls_test.rs +++ b/crates/xline/tests/it/tls_test.rs @@ -4,9 +4,9 @@ use etcd_client::ConnectOptions; use test_macros::abort_on_panic; use tonic::transport::{Certificate, ClientTlsConfig, Identity}; use utils::config::{ - auth_config::AuthConfig, cluster_config::ClusterConfig, compact_config::CompactConfig, - log_config::LogConfig, metrics_config::MetricsConfig, storage_config::StorageConfig, - tls_config::TlsConfig, trace_config::TraceConfig, XlineServerConfig, + auth::AuthConfig, cluster::ClusterConfig, compact::CompactConfig, log::LogConfig, + metrics::MetricsConfig, storage::StorageConfig, tls::TlsConfig, trace::TraceConfig, + XlineServerConfig, }; use xline_client::types::kv::PutRequest; use xline_test_utils::{enable_auth, set_user, Cluster}; diff --git a/crates/xlinectl/src/main.rs b/crates/xlinectl/src/main.rs index 8559bfe87..fe76d5ff2 100644 --- a/crates/xlinectl/src/main.rs +++ b/crates/xlinectl/src/main.rs @@ -162,7 +162,7 @@ use std::{path::PathBuf, time::Duration}; use anyhow::Result; use clap::{arg, value_parser, Command}; use command::compaction; -use ext_utils::config::client_config::ClientConfig; +use ext_utils::config::client::ClientConfig; use tokio::fs; use tonic::transport::{Certificate, ClientTlsConfig}; use xline_client::{Client, ClientOptions};