66//! - `rebuild` → DB reconstruction from volume servers
77//! - `rebalance` → key migration to ideal volumes
88
9- mod cli;
10- mod error;
11- mod http;
12-
139use minikv_core:: storage;
1410
1511use std:: collections:: HashMap ;
@@ -21,12 +17,12 @@ use dashmap::DashMap;
2117use tracing:: { error, info} ;
2218use tracing_subscriber:: EnvFilter ;
2319
24- use cli:: { Cli , Command } ;
2520use minikv_core:: locking:: KeyLock ;
2621use minikv_core:: rebalance:: rebalance_all;
2722use minikv_core:: rebuild:: rebuild_all;
2823use minikv_core:: replication:: build_volume_client;
2924use minikv_core:: state:: AppState ;
25+ use minikv_server:: cli:: { Cli , Command , CommonArgs , validate_common} ;
3026use storage:: leveldb:: LevelDbStore ;
3127
3228#[ tokio:: main]
@@ -39,7 +35,7 @@ async fn main() {
3935 }
4036 Command :: Server ( args) => {
4137 init_logging ( args. verbose ) ;
42- cli :: validate_common ( & args. common ) ;
38+ validate_common ( & args. common ) ;
4339
4440 info ! (
4541 port = args. port,
@@ -78,7 +74,7 @@ async fn main() {
7874 http_client : build_volume_client ( ) ,
7975 } ) ;
8076
81- let router = http:: build_router ( Arc :: clone ( & state) ) ;
77+ let router = minikv_server :: http:: build_router ( Arc :: clone ( & state) ) ;
8278 let addr = SocketAddr :: from ( ( [ 0 , 0 , 0 , 0 ] , args. port ) ) ;
8379 let listener = tokio:: net:: TcpListener :: bind ( addr)
8480 . await
@@ -96,7 +92,7 @@ async fn main() {
9692
9793 Command :: Rebuild ( args) => {
9894 init_logging ( false ) ;
99- cli :: validate_common ( & args) ;
95+ validate_common ( & args) ;
10096
10197 info ! ( volumes = ?args. volumes, "starting rebuild" ) ;
10298
@@ -122,7 +118,7 @@ async fn main() {
122118
123119 Command :: Rebalance ( args) => {
124120 init_logging ( false ) ;
125- cli :: validate_common ( & args) ;
121+ validate_common ( & args) ;
126122
127123 info ! ( volumes = ?args. volumes, "starting rebalance" ) ;
128124
@@ -149,7 +145,7 @@ async fn main() {
149145}
150146
151147/// Open LevelDB or exit with a clear error message.
152- fn open_db ( args : & cli :: CommonArgs ) -> LevelDbStore {
148+ fn open_db ( args : & CommonArgs ) -> LevelDbStore {
153149 LevelDbStore :: open ( & args. db ) . unwrap_or_else ( |e| {
154150 eprintln ! ( "error: failed to open LevelDB at {:?}: {e}" , args. db) ;
155151 std:: process:: exit ( 1 ) ;
0 commit comments