Skip to main content

blockfrost_openapi/models/
snapshot.rs

1use crate::models;
2use serde::{Deserialize, Serialize};
3
4/// Snapshot : Snapshot represents a snapshot file and its metadata
5#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
6pub struct Snapshot {
7    /// Digest that is signed by the signer participants
8    #[serde(rename = "digest")]
9    pub digest: String,
10    #[serde(rename = "beacon")]
11    pub beacon: models::CardanoDbBeacon,
12    /// Hash of the associated certificate
13    #[serde(rename = "certificate_hash")]
14    pub certificate_hash: String,
15    /// Size of the snapshot file in Bytes
16    #[serde(rename = "size")]
17    pub size: i64,
18    /// Date and time at which the snapshot was created
19    #[serde(rename = "created_at")]
20    pub created_at: String,
21    /// Locations where the binary content of the snapshot can be retrieved
22    #[serde(rename = "locations")]
23    pub locations: Vec<String>,
24    /// Compression algorithm for the snapshot archive
25    #[serde(rename = "compression_algorithm", skip_serializing_if = "Option::is_none")]
26    pub compression_algorithm: Option<String>,
27    /// Version of the Cardano node which is used to create snapshot archives.
28    #[serde(rename = "cardano_node_version", skip_serializing_if = "Option::is_none")]
29    pub cardano_node_version: Option<String>,
30}
31
32impl Snapshot {
33    /// Snapshot represents a snapshot file and its metadata
34    pub fn new(digest: String, beacon: models::CardanoDbBeacon, certificate_hash: String, size: i64, created_at: String, locations: Vec<String>) -> Snapshot {
35        Snapshot {
36            digest,
37            beacon,
38            certificate_hash,
39            size,
40            created_at,
41            locations,
42            compression_algorithm: None,
43            cardano_node_version: None,
44        }
45    }
46}
47