Skip to content

Commit f9d5379

Browse files
committed
refactor: use specific types for each ArtifactsLocations field
1 parent 92d63e3 commit f9d5379

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

mithril-aggregator/src/artifact_builder/cardano_database.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,7 @@ mod tests {
199199
"merkleroot".to_string(),
200200
beacon,
201201
expected_total_size,
202-
ArtifactsLocations {
203-
digest: vec![],
204-
immutables: vec![],
205-
ancillary: vec![],
206-
},
202+
ArtifactsLocations::default(),
207203
CompressionAlgorithm::Zstandard,
208204
&Version::parse("1.0.0").unwrap(),
209205
);

mithril-common/src/entities/cardano_database.rs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,32 @@ impl CardanoDatabaseSnapshot {
5353

5454
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
5555
#[serde(rename_all = "snake_case", tag = "type")]
56-
pub enum ArtifactLocation {
56+
enum DigestLocation {
5757
Aggregator { uri: String },
5858
CloudStorage { uri: String },
5959
}
6060

61+
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
62+
#[serde(rename_all = "snake_case", tag = "type")]
63+
enum ImmutablesLocation {
64+
CloudStorage { uri: String },
65+
}
66+
67+
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
68+
#[serde(rename_all = "snake_case", tag = "type")]
69+
enum AncillaryLocation {
70+
CloudStorage { uri: String },
71+
}
72+
6173
/// Locations of the Cardano database related files.
6274
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
6375
pub struct ArtifactsLocations {
6476
/// Locations of the the immutable file digests.
65-
pub digest: Vec<ArtifactLocation>,
77+
digest: Vec<DigestLocation>,
6678
/// Locations of the immutable files.
67-
pub immutables: Vec<ArtifactLocation>,
68-
/// Locations of the ancillary files (ledger and volatile).
69-
pub ancillary: Vec<ArtifactLocation>,
79+
immutables: Vec<ImmutablesLocation>,
80+
/// Locations of the ancillary files.
81+
ancillary: Vec<AncillaryLocation>,
7082
}
7183

7284
#[typetag::serde]

0 commit comments

Comments
 (0)