canic_core/dto/root_store/
mod.rs1use crate::ids::{
4 CanisterRole, ComponentSpecId, ComponentTopologyDigest, FleetSubnetRootReleaseSet,
5 ReleaseBuildId,
6};
7use candid::{CandidType, Principal};
8use serde::{Deserialize, Serialize};
9
10pub const ROOT_STORE_RELEASE_SET_MANIFEST_MAX_BYTES: u64 = 16 * 1_024 * 1_024;
12pub const ROOT_STORE_RELEASE_SET_TEMPLATE_PREFIX: &str = "root-release-set:";
14pub const ROOT_STORE_ARTIFACT_TEMPLATE_PREFIX: &str = "component:";
16
17#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
24#[serde(deny_unknown_fields)]
25pub struct RootStoreArtifact {
26 pub role: CanisterRole,
27 pub package: String,
28 pub release_build_id: ReleaseBuildId,
29 pub wasm_relative_path: String,
30 pub wasm_size_bytes: u64,
31 pub wasm_sha256_hex: String,
32 pub wasm_gz_relative_path: String,
33 pub wasm_gz_size_bytes: u64,
34 pub wasm_gz_sha256_hex: String,
35}
36
37#[derive(
44 CandidType, Clone, Copy, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize,
45)]
46pub enum RootStoreReleaseSetEntryKind {
47 #[serde(rename = "component")]
48 Component,
49
50 #[serde(rename = "component_child")]
51 ComponentChild,
52}
53
54#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
61#[serde(deny_unknown_fields)]
62pub struct RootStoreReleaseSetEntry {
63 pub component_spec: ComponentSpecId,
64 pub kind: RootStoreReleaseSetEntryKind,
65 pub artifact: RootStoreArtifact,
66}
67
68#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
75#[serde(deny_unknown_fields)]
76pub struct RootStoreReleaseSetManifest {
77 pub release_build_id: ReleaseBuildId,
78 pub component_topology_digest: ComponentTopologyDigest,
79 pub entries: Vec<RootStoreReleaseSetEntry>,
80}
81
82#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
89pub struct RootStoreBootstrapRequest {
90 pub manifest_payload_size_bytes: u64,
91}
92
93#[derive(CandidType, Clone, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)]
100pub struct RootStoreCatalogEntry {
101 pub role: CanisterRole,
102 pub payload_hash: [u8; 32],
103 pub payload_size_bytes: u64,
104}
105
106#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
113pub struct RootStoreBootstrapResponse {
114 pub fleet_subnet_root: Principal,
115 pub wasm_store: Principal,
116 pub release_set: FleetSubnetRootReleaseSet,
117 pub catalog: Vec<RootStoreCatalogEntry>,
118}