Skip to content

Commit

Permalink
refactor: split config into multiple modules
Browse files Browse the repository at this point in the history
Signed-off-by: Harsh1s <[email protected]>
  • Loading branch information
Harsh1s committed Mar 6, 2024
1 parent f12ba4c commit 398a86b
Show file tree
Hide file tree
Showing 43 changed files with 1,739 additions and 1,549 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::ClientConfig;
use utils::config::client_config::ClientConfig;
use xline_client::{types::kv::PutRequest, ClientOptions};

use crate::{args::Commands, bench_client::BenchClient, Benchmark};
Expand Down
4 changes: 2 additions & 2 deletions 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::EngineConfig;
use utils::config::engine_config::EngineConfig;

use crate::{META_TABLE, REVISION_TABLE, TEST_TABLE};

Expand Down Expand Up @@ -411,7 +411,7 @@ impl TestCE {
after_sync_sender: mpsc::UnboundedSender<(TestCommand, LogIndex)>,
engine_cfg: EngineConfig,
) -> Self {
let engine_type = match engine_cfg {
let engine_type: EngineType = match engine_cfg {
EngineConfig::Memory => EngineType::Memory,
EngineConfig::RocksDB(path) => EngineType::Rocks(path),
_ => unreachable!("Not supported storage type"),
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 @@ -26,9 +26,9 @@ use futures::{stream::FuturesUnordered, StreamExt};
#[cfg(not(madsim))]
use tonic::transport::ClientTlsConfig;
use tracing::debug;
use utils::{build_endpoint, config::client_config::ClientConfig};
#[cfg(madsim)]
use utils::ClientTlsConfig;
use utils::{build_endpoint, config::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 @@ -415,7 +415,7 @@ mod tests {
use test_macros::abort_on_panic;
use tokio::{sync::mpsc, time::Instant};
use tracing_test::traced_test;
use utils::config::EngineConfig;
use utils::config::engine_config::EngineConfig;

use super::*;
use crate::{log_entry::LogEntry, rpc::ProposeId};
Expand Down
5 changes: 1 addition & 4 deletions crates/curp/src/server/curp_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,9 @@ use tokio::{
#[cfg(not(madsim))]
use tonic::transport::ClientTlsConfig;
use tracing::{debug, error, info, trace, warn};
use utils::{config::curp_config::CurpConfig, task_manager::{tasks::TaskName, Listener, State, TaskManager}};
#[cfg(madsim)]
use utils::ClientTlsConfig;
use utils::{
config::CurpConfig,
task_manager::{tasks::TaskName, Listener, State, TaskManager},
};

use super::{
cmd_board::{CmdBoardRef, CommandBoard},
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::CurpConfig, task_manager::TaskManager, tracing::Extract};
use utils::{config::curp_config::CurpConfig, task_manager::TaskManager, tracing::Extract};

use self::curp_node::CurpNode;
pub use self::raw_curp::RawCurp;
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::{default_batch_max_size, default_log_entries_cap};
use utils::config::curp_config::{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 @@ -38,7 +38,7 @@ use tracing::{
#[cfg(madsim)]
use utils::ClientTlsConfig;
use utils::{
config::CurpConfig,
config::curp_config::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::{
use utils::config::curp_config::{
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::EngineConfig;
use utils::config::engine_config::EngineConfig;

use super::{StorageApi, StorageError};
use crate::{
Expand Down
3 changes: 2 additions & 1 deletion crates/curp/tests/it/common/curp_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ use tracing::debug;
use utils::{
build_endpoint,
config::{
default_quota, ClientConfig, CurpConfig, CurpConfigBuilder, EngineConfig, StorageConfig,
client_config::ClientConfig, curp_config::CurpConfig, curp_config::CurpConfigBuilder,
engine_config::EngineConfig, storage_config::default_quota, storage_config::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::ClientConfig, timestamp};
use utils::{config::client_config::ClientConfig, timestamp};

use crate::common::curp_group::{
commandpb::ProposeId, CurpGroup, FetchClusterRequest, ProposeRequest, ProposeResponse,
Expand Down
Loading

0 comments on commit 398a86b

Please sign in to comment.