mithril_common/entities/
snapshot.rsuse crate::{
entities::{CardanoDbBeacon, CompressionAlgorithm},
signable_builder::Artifact,
};
use semver::Version;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
pub struct Snapshot {
pub digest: String,
pub network: String,
pub beacon: CardanoDbBeacon,
pub size: u64,
pub locations: Vec<String>,
pub compression_algorithm: CompressionAlgorithm,
pub cardano_node_version: String,
}
impl Snapshot {
pub fn new<N: Into<String>>(
digest: String,
network: N,
beacon: CardanoDbBeacon,
size: u64,
locations: Vec<String>,
compression_algorithm: CompressionAlgorithm,
cardano_node_version: &Version,
) -> Snapshot {
let cardano_node_version = format!("{cardano_node_version}");
Snapshot {
digest,
network: network.into(),
beacon,
size,
locations,
compression_algorithm,
cardano_node_version,
}
}
}
#[typetag::serde]
impl Artifact for Snapshot {
fn get_id(&self) -> String {
self.digest.clone()
}
}