Skip to content

Commit

Permalink
refactor: modify modules' name to meet the clippy lint
Browse files Browse the repository at this point in the history
Signed-off-by: Phoeniix Zhao <[email protected]>
  • Loading branch information
Phoenix500526 committed May 16, 2024
1 parent d41a714 commit 9c1aaa9
Show file tree
Hide file tree
Showing 43 changed files with 96 additions and 93 deletions.
2 changes: 1 addition & 1 deletion crates/benchmark/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion crates/curp-test-utils/src/test_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
2 changes: 1 addition & 1 deletion crates/curp/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
2 changes: 1 addition & 1 deletion crates/curp/src/server/cmd_worker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion crates/curp/src/server/curp_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
};

Expand Down
2 changes: 1 addition & 1 deletion crates/curp/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down
2 changes: 1 addition & 1 deletion crates/curp/src/server/raw_curp/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;

Expand Down
2 changes: 1 addition & 1 deletion crates/curp/src/server/raw_curp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
2 changes: 1 addition & 1 deletion crates/curp/src/server/raw_curp/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
2 changes: 1 addition & 1 deletion crates/curp/src/server/storage/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down
8 changes: 4 additions & 4 deletions crates/curp/tests/it/common/curp_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
};
Expand Down
2 changes: 1 addition & 1 deletion crates/curp/tests/it/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -105,6 +105,7 @@ impl ClusterConfig {
}

/// Cluster Range type alias
#[allow(clippy::module_name_repetitions)]
pub type ClusterRange = std::ops::Range<u64>;

/// Initial cluster state of xline server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down Expand Up @@ -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,
Expand Down
45 changes: 22 additions & 23 deletions crates/utils/src/config/mod.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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,
};
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
6 changes: 3 additions & 3 deletions crates/utils/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion crates/xline-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down
18 changes: 9 additions & 9 deletions crates/xline-test-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion crates/xline/src/server/maintenance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 1 addition & 3 deletions crates/xline/src/server/watch_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down
12 changes: 6 additions & 6 deletions crates/xline/src/server/xline_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
};
Expand Down
2 changes: 1 addition & 1 deletion crates/xline/src/storage/auth_store/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down
2 changes: 1 addition & 1 deletion crates/xline/src/storage/compact/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion crates/xline/src/storage/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading

0 comments on commit 9c1aaa9

Please sign in to comment.