snops_common/
api.rs

1use indexmap::IndexMap;
2use serde::{Deserialize, Serialize};
3use snops_checkpoint::RetentionPolicy;
4
5use crate::{
6    binaries::BinaryEntry,
7    prelude::StorageId,
8    state::{InternedId, LatestBlockInfo, NetworkId},
9};
10
11/// Metadata about a checkpoint file
12#[derive(Debug, Serialize, Deserialize, Clone)]
13pub struct CheckpointMeta {
14    pub height: u32,
15    pub timestamp: i64,
16    pub filename: String,
17}
18
19#[derive(Debug, Serialize, Deserialize, Clone)]
20pub struct EnvInfo {
21    pub network: NetworkId,
22    pub storage: StorageInfo,
23    pub block: Option<LatestBlockInfo>,
24}
25
26#[derive(Debug, Serialize, Deserialize, Clone)]
27pub struct StorageInfo {
28    /// String id of this storage
29    pub id: StorageId,
30    /// The retention policy used for this storage
31    pub retention_policy: Option<RetentionPolicy>,
32    /// The available checkpoints in this storage
33    pub checkpoints: Vec<CheckpointMeta>,
34    /// Whether to persist the ledger
35    pub persist: bool,
36    /// Version identifier for this ledger
37    pub version: u16,
38    /// Whether to use the network's native genesis block
39    pub native_genesis: bool,
40    /// A map of the snarkos binary ids to a potential download url (when None,
41    /// download from the control plane)
42    pub binaries: IndexMap<InternedId, BinaryEntry>,
43}