Skip to content

Commit 496b5dc

Browse files
committed
fix: removed duplicate lines
1 parent 3982da4 commit 496b5dc

File tree

1 file changed

+0
-227
lines changed

1 file changed

+0
-227
lines changed

cli/src/config.rs

Lines changed: 0 additions & 227 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,6 @@ pub struct MiningConfig {
2222
pub max_pow_threads: u64,
2323
}
2424

25-
#[derive(Debug, Serialize, Deserialize, Clone)]
26-
pub struct PerformanceConfig {
27-
pub num_cores: usize,
28-
pub max_memory_mb: u64,
29-
pub max_poa_threads: u64,
30-
pub max_pow_threads: u64,
31-
}
32-
33-
#[derive(Debug, Serialize, Deserialize, Clone)]
34-
pub struct PerformanceConfig {
35-
pub num_cores: usize,
36-
pub max_memory_mb: u64,
37-
pub max_poa_threads: u64,
38-
pub max_pow_threads: u64,
39-
}
40-
4125
#[derive(Debug, Serialize, Deserialize, Clone)]
4226
pub struct IdentityConfig {
4327
pub keypair_path: String,
@@ -117,133 +101,6 @@ impl CommitmentLevel {
117101
}
118102

119103

120-
#[derive(Debug, Serialize, Deserialize, Clone)]
121-
pub struct StorageConfig {
122-
pub backend: StorageBackend,
123-
pub rocksdb: Option<RocksDbConfig>,
124-
}
125-
126-
#[derive(Debug, Serialize, Deserialize, Clone)]
127-
pub struct RocksDbConfig {
128-
pub primary_path: String,
129-
pub secondary_path: Option<String>,
130-
pub cache_size_mb: u64,
131-
}
132-
133-
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
134-
pub enum StorageBackend {
135-
RocksDb,
136-
Postgres
137-
}
138-
139-
#[derive(Debug, Serialize, Deserialize, Clone)]
140-
pub struct LoggingConfig {
141-
pub log_level: LogLevel,
142-
pub log_path: Option<String>,
143-
}
144-
145-
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
146-
#[serde(rename_all = "lowercase")]
147-
pub enum LogLevel {
148-
Error,
149-
Warn,
150-
Info,
151-
Debug,
152-
Trace,
153-
}
154-
155-
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
156-
#[serde(rename_all = "lowercase")]
157-
pub enum CommitmentLevel {
158-
Processed,
159-
Confirmed,
160-
Finalized,
161-
}
162-
163-
impl ToString for CommitmentLevel {
164-
fn to_string(&self) -> String {
165-
match self {
166-
CommitmentLevel::Processed => "processed".to_string(),
167-
CommitmentLevel::Confirmed => "confirmed".to_string(),
168-
CommitmentLevel::Finalized => "finalized".to_string(),
169-
}
170-
}
171-
}
172-
173-
impl CommitmentLevel {
174-
pub fn to_commitment_config(&self) -> CommitmentConfig {
175-
match self {
176-
CommitmentLevel::Processed => CommitmentConfig::processed(),
177-
CommitmentLevel::Confirmed => CommitmentConfig::confirmed(),
178-
CommitmentLevel::Finalized => CommitmentConfig::finalized(),
179-
}
180-
}
181-
}
182-
183-
184-
#[derive(Debug, Serialize, Deserialize, Clone)]
185-
pub struct StorageConfig {
186-
pub backend: StorageBackend,
187-
pub rocksdb: Option<RocksDbConfig>,
188-
}
189-
190-
#[derive(Debug, Serialize, Deserialize, Clone)]
191-
pub struct RocksDbConfig {
192-
pub primary_path: String,
193-
pub secondary_path: Option<String>,
194-
pub cache_size_mb: u64,
195-
}
196-
197-
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
198-
pub enum StorageBackend {
199-
RocksDb,
200-
Postgres
201-
}
202-
203-
#[derive(Debug, Serialize, Deserialize, Clone)]
204-
pub struct LoggingConfig {
205-
pub log_level: LogLevel,
206-
pub log_path: Option<String>,
207-
}
208-
209-
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
210-
#[serde(rename_all = "lowercase")]
211-
pub enum LogLevel {
212-
Error,
213-
Warn,
214-
Info,
215-
Debug,
216-
Trace,
217-
}
218-
219-
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
220-
#[serde(rename_all = "lowercase")]
221-
pub enum CommitmentLevel {
222-
Processed,
223-
Confirmed,
224-
Finalized,
225-
}
226-
227-
impl ToString for CommitmentLevel {
228-
fn to_string(&self) -> String {
229-
match self {
230-
CommitmentLevel::Processed => "processed".to_string(),
231-
CommitmentLevel::Confirmed => "confirmed".to_string(),
232-
CommitmentLevel::Finalized => "finalized".to_string(),
233-
}
234-
}
235-
}
236-
237-
impl CommitmentLevel {
238-
pub fn to_commitment_config(&self) -> CommitmentConfig {
239-
match self {
240-
CommitmentLevel::Processed => CommitmentConfig::processed(),
241-
CommitmentLevel::Confirmed => CommitmentConfig::confirmed(),
242-
CommitmentLevel::Finalized => CommitmentConfig::finalized(),
243-
}
244-
}
245-
}
246-
247104
impl TapeConfig {
248105

249106
pub fn load_with_path(config_path: &Option<PathBuf>) -> Result<Self, TapeConfigError> {
@@ -319,54 +176,6 @@ impl TapeConfig {
319176
Ok(())
320177
}
321178

322-
fn validate_url(&self, url: &str, field_name: &str, valid_schemes: &[&str]) -> Result<(), TapeConfigError> {
323-
let has_valid_scheme = valid_schemes.iter().any(|scheme| url.starts_with(scheme));
324-
325-
if !has_valid_scheme {
326-
return Err(TapeConfigError::InvalidUrl(
327-
format!("{} must start with one of {:?}, found: '{}'", field_name, valid_schemes, url)
328-
));
329-
}
330-
331-
if url.contains(' ') {
332-
return Err(TapeConfigError::InvalidUrl(
333-
format!("{} cannot contain spaces, found: '{}'", field_name, url)
334-
));
335-
}
336-
337-
if url.trim().is_empty() {
338-
return Err(TapeConfigError::InvalidUrl(
339-
format!("{} cannot be empty", field_name)
340-
));
341-
}
342-
343-
Ok(())
344-
}
345-
346-
fn validate_url(&self, url: &str, field_name: &str, valid_schemes: &[&str]) -> Result<(), TapeConfigError> {
347-
let has_valid_scheme = valid_schemes.iter().any(|scheme| url.starts_with(scheme));
348-
349-
if !has_valid_scheme {
350-
return Err(TapeConfigError::InvalidUrl(
351-
format!("{} must start with one of {:?}, found: '{}'", field_name, valid_schemes, url)
352-
));
353-
}
354-
355-
if url.contains(' ') {
356-
return Err(TapeConfigError::InvalidUrl(
357-
format!("{} cannot contain spaces, found: '{}'", field_name, url)
358-
));
359-
}
360-
361-
if url.trim().is_empty() {
362-
return Err(TapeConfigError::InvalidUrl(
363-
format!("{} cannot be empty", field_name)
364-
));
365-
}
366-
367-
Ok(())
368-
}
369-
370179
/// create default configuration and save to file
371180
pub fn create_default() -> Result<Self, TapeConfigError> {
372181
let config = Self::default();
@@ -405,18 +214,6 @@ impl Default for TapeConfig {
405214
max_poa_threads: 4,
406215
max_pow_threads: 4
407216
},
408-
performance: PerformanceConfig{
409-
num_cores: num_cpus::get(),
410-
max_memory_mb: 16384,
411-
max_poa_threads: 4,
412-
max_pow_threads: 4
413-
},
414-
performance: PerformanceConfig{
415-
num_cores: num_cpus::get(),
416-
max_memory_mb: 16384,
417-
max_poa_threads: 4,
418-
max_pow_threads: 4
419-
},
420217
identity: IdentityConfig {
421218
keypair_path: "~/.config/solana/id.json".to_string(),
422219
},
@@ -439,30 +236,6 @@ impl Default for TapeConfig {
439236
log_level: LogLevel::Info,
440237
log_path: Some("./logs/tape.log".to_string()),
441238
},
442-
storage: StorageConfig {
443-
backend: StorageBackend::RocksDb,
444-
rocksdb: Some(RocksDbConfig{
445-
primary_path: "./db_tapestore".to_string(),
446-
secondary_path: Some("./db_tapestore_secondary".to_string()),
447-
cache_size_mb: 512,
448-
})
449-
},
450-
logging: LoggingConfig {
451-
log_level: LogLevel::Info,
452-
log_path: Some("./logs/tape.log".to_string()),
453-
},
454-
storage: StorageConfig {
455-
backend: StorageBackend::RocksDb,
456-
rocksdb: Some(RocksDbConfig{
457-
primary_path: "./db_tapestore".to_string(),
458-
secondary_path: Some("./db_tapestore_secondary".to_string()),
459-
cache_size_mb: 512,
460-
})
461-
},
462-
logging: LoggingConfig {
463-
log_level: LogLevel::Info,
464-
log_path: Some("./logs/tape.log".to_string()),
465-
},
466239
}
467240
}
468241
}

0 commit comments

Comments
 (0)