|
| 1 | +use anyhow::anyhow; |
1 | 2 | use config::{ConfigError, Map, Source, Value, ValueKind};
|
2 | 3 | use mithril_common::crypto_helper::ProtocolGenesisSigner;
|
3 | 4 | use mithril_common::era::adapters::EraReaderAdapterType;
|
4 | 5 | use serde::{Deserialize, Serialize};
|
5 | 6 | use std::path::PathBuf;
|
6 | 7 | use std::str::FromStr;
|
7 |
| -use std::sync::Arc; |
8 | 8 |
|
9 | 9 | use mithril_common::entities::{
|
10 | 10 | CompressionAlgorithm, HexEncodedGenesisVerificationKey, ProtocolParameters,
|
11 | 11 | };
|
12 | 12 | use mithril_common::{CardanoNetwork, StdResult};
|
13 | 13 |
|
14 |
| -use crate::tools::GcpFileUploader; |
15 |
| -use crate::{LocalSnapshotUploader, RemoteSnapshotUploader, SnapshotUploader}; |
16 |
| - |
17 | 14 | /// Different kinds of execution environments
|
18 | 15 | #[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)]
|
19 | 16 | pub enum ExecutionEnvironment {
|
@@ -199,30 +196,10 @@ impl Configuration {
|
199 | 196 | format!("http://{}:{}/", self.server_ip, self.server_port)
|
200 | 197 | }
|
201 | 198 |
|
202 |
| - /// Create a snapshot uploader from configuration settings. |
203 |
| - pub fn build_snapshot_uploader(&self) -> StdResult<Arc<dyn SnapshotUploader>> { |
204 |
| - match self.snapshot_uploader_type { |
205 |
| - SnapshotUploaderType::Gcp => { |
206 |
| - let bucket = self.snapshot_bucket_name.to_owned().ok_or_else(|| { |
207 |
| - ConfigError::Message("missing snapshot bucket name".to_string()) |
208 |
| - })?; |
209 |
| - Ok(Arc::new(RemoteSnapshotUploader::new( |
210 |
| - Box::new(GcpFileUploader::new(bucket.clone())), |
211 |
| - bucket, |
212 |
| - self.snapshot_use_cdn_domain, |
213 |
| - ))) |
214 |
| - } |
215 |
| - SnapshotUploaderType::Local => Ok(Arc::new(LocalSnapshotUploader::new( |
216 |
| - self.get_server_url(), |
217 |
| - &self.snapshot_directory, |
218 |
| - ))), |
219 |
| - } |
220 |
| - } |
221 |
| - |
222 | 199 | /// Check configuration and return a representation of the Cardano network.
|
223 |
| - pub fn get_network(&self) -> Result<CardanoNetwork, ConfigError> { |
| 200 | + pub fn get_network(&self) -> StdResult<CardanoNetwork> { |
224 | 201 | CardanoNetwork::from_code(self.network.clone(), self.network_magic)
|
225 |
| - .map_err(|e| ConfigError::Message(e.to_string())) |
| 202 | + .map_err(|e| anyhow!(ConfigError::Message(e.to_string()))) |
226 | 203 | }
|
227 | 204 |
|
228 | 205 | /// Return the file of the SQLite stores. If the directory does not exist, it is created.
|
|
0 commit comments