@@ -109,69 +109,6 @@ impl CommitmentLevel {
109109}
110110
111111
112- #[ derive( Debug , Serialize , Deserialize , Clone ) ]
113- pub struct StorageConfig {
114- pub backend : StorageBackend ,
115- pub rocksdb : Option < RocksDbConfig > ,
116- }
117-
118- #[ derive( Debug , Serialize , Deserialize , Clone ) ]
119- pub struct RocksDbConfig {
120- pub primary_path : String ,
121- pub secondary_path : Option < String > ,
122- pub cache_size_mb : u64 ,
123- }
124-
125- #[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
126- pub enum StorageBackend {
127- RocksDb ,
128- Postgres
129- }
130-
131- #[ derive( Debug , Serialize , Deserialize , Clone ) ]
132- pub struct LoggingConfig {
133- pub log_level : LogLevel ,
134- pub log_path : Option < String > ,
135- }
136-
137- #[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
138- #[ serde( rename_all = "lowercase" ) ]
139- pub enum LogLevel {
140- Error ,
141- Warn ,
142- Info ,
143- Debug ,
144- Trace ,
145- }
146-
147- #[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
148- #[ serde( rename_all = "lowercase" ) ]
149- pub enum CommitmentLevel {
150- Processed ,
151- Confirmed ,
152- Finalized ,
153- }
154-
155- impl ToString for CommitmentLevel {
156- fn to_string ( & self ) -> String {
157- match self {
158- CommitmentLevel :: Processed => "processed" . to_string ( ) ,
159- CommitmentLevel :: Confirmed => "confirmed" . to_string ( ) ,
160- CommitmentLevel :: Finalized => "finalized" . to_string ( ) ,
161- }
162- }
163- }
164-
165- impl CommitmentLevel {
166- pub fn to_commitment_config ( & self ) -> CommitmentConfig {
167- match self {
168- CommitmentLevel :: Processed => CommitmentConfig :: processed ( ) ,
169- CommitmentLevel :: Confirmed => CommitmentConfig :: confirmed ( ) ,
170- CommitmentLevel :: Finalized => CommitmentConfig :: finalized ( ) ,
171- }
172- }
173- }
174-
175112impl TapeConfig {
176113
177114 pub fn load_with_path ( config_path : & Option < PathBuf > ) -> Result < Self , TapeConfigError > {
@@ -247,30 +184,6 @@ impl TapeConfig {
247184 Ok ( ( ) )
248185 }
249186
250- fn validate_url ( & self , url : & str , field_name : & str , valid_schemes : & [ & str ] ) -> Result < ( ) , TapeConfigError > {
251- let has_valid_scheme = valid_schemes. iter ( ) . any ( |scheme| url. starts_with ( scheme) ) ;
252-
253- if !has_valid_scheme {
254- return Err ( TapeConfigError :: InvalidUrl (
255- format ! ( "{} must start with one of {:?}, found: '{}'" , field_name, valid_schemes, url)
256- ) ) ;
257- }
258-
259- if url. contains ( ' ' ) {
260- return Err ( TapeConfigError :: InvalidUrl (
261- format ! ( "{} cannot contain spaces, found: '{}'" , field_name, url)
262- ) ) ;
263- }
264-
265- if url. trim ( ) . is_empty ( ) {
266- return Err ( TapeConfigError :: InvalidUrl (
267- format ! ( "{} cannot be empty" , field_name)
268- ) ) ;
269- }
270-
271- Ok ( ( ) )
272- }
273-
274187 /// create default configuration and save to file
275188 pub fn create_default ( ) -> Result < Self , TapeConfigError > {
276189 let config = Self :: default ( ) ;
@@ -309,12 +222,6 @@ impl Default for TapeConfig {
309222 max_poa_threads : 4 ,
310223 max_pow_threads : 4
311224 } ,
312- performance : PerformanceConfig {
313- num_cores : num_cpus:: get ( ) ,
314- max_memory_mb : 16384 ,
315- max_poa_threads : 4 ,
316- max_pow_threads : 4
317- } ,
318225 identity : IdentityConfig {
319226 keypair_path : "~/.config/solana/id.json" . to_string ( ) ,
320227 } ,
@@ -337,18 +244,6 @@ impl Default for TapeConfig {
337244 log_level : LogLevel :: Info ,
338245 log_path : Some ( "./logs/tape.log" . to_string ( ) ) ,
339246 } ,
340- storage : StorageConfig {
341- backend : StorageBackend :: RocksDb ,
342- rocksdb : Some ( RocksDbConfig {
343- primary_path : "./db_tapestore" . to_string ( ) ,
344- secondary_path : Some ( "./db_tapestore_secondary" . to_string ( ) ) ,
345- cache_size_mb : 512 ,
346- } )
347- } ,
348- logging : LoggingConfig {
349- log_level : LogLevel :: Info ,
350- log_path : Some ( "./logs/tape.log" . to_string ( ) ) ,
351- } ,
352247 }
353248 }
354249}
0 commit comments