@@ -4,6 +4,7 @@ use crate::snapshot_uploaders::SnapshotUploader;
44use crate :: tools:: GcpFileUploader ;
55use crate :: { LocalSnapshotUploader , RemoteSnapshotStore , RemoteSnapshotUploader } ;
66use serde:: { Deserialize , Serialize } ;
7+ use std:: path:: PathBuf ;
78use std:: sync:: Arc ;
89use tokio:: sync:: RwLock ;
910
@@ -21,6 +22,15 @@ pub struct Config {
2122
2223 /// Type of snapshot uploader to use
2324 pub snapshot_uploader_type : SnapshotUploaderType ,
25+
26+ /// Server listening IP
27+ pub server_url : String ,
28+
29+ /// Directory to snapshot
30+ pub db_directory : PathBuf ,
31+
32+ /// Directory to store snapshot
33+ pub snapshot_directory : PathBuf ,
2434}
2535
2636#[ derive( Debug , Clone , Serialize , Deserialize , PartialEq ) ]
@@ -48,19 +58,14 @@ impl Config {
4858 }
4959 }
5060
51- pub fn build_snapshot_uploader (
52- & self ,
53- snapshot_server_url : String ,
54- snapshot_server_port : u16 ,
55- ) -> Box < dyn SnapshotUploader > {
61+ pub fn build_snapshot_uploader ( & self ) -> Box < dyn SnapshotUploader > {
5662 match self . snapshot_store_type {
5763 SnapshotStoreType :: Gcp => Box :: new ( RemoteSnapshotUploader :: new ( Box :: new (
5864 GcpFileUploader :: default ( ) ,
5965 ) ) ) ,
60- SnapshotStoreType :: Local => Box :: new ( LocalSnapshotUploader :: new (
61- snapshot_server_url,
62- snapshot_server_port,
63- ) ) ,
66+ SnapshotStoreType :: Local => {
67+ Box :: new ( LocalSnapshotUploader :: new ( self . server_url . clone ( ) ) )
68+ }
6469 }
6570 }
6671}
0 commit comments