Skip to main content

canic_core/dto/
cascade.rs

1use crate::dto::{
2    prelude::*,
3    state::{AppStateInput, SubnetStateInput},
4    topology::{AppDirectoryArgs, SubnetDirectoryArgs},
5};
6
7//
8// StateSnapshotInput
9//
10// Cascade state snapshot.
11//
12
13#[derive(CandidType, Clone, Debug, Deserialize)]
14pub struct StateSnapshotInput {
15    pub app_state: Option<AppStateInput>,
16    pub subnet_state: Option<SubnetStateInput>,
17    pub app_directory: Option<AppDirectoryArgs>,
18    pub subnet_directory: Option<SubnetDirectoryArgs>,
19}
20
21//
22// TopologySnapshotInput
23//
24// Cascade topology snapshot.
25//
26
27#[derive(CandidType, Clone, Debug, Deserialize)]
28pub struct TopologySnapshotInput {
29    pub parents: Vec<TopologyPathNode>,
30    // Children keyed by parent pid.
31    pub children_map: Vec<TopologyChildren>,
32}
33
34//
35// TopologyChildren
36//
37// Parent-keyed child list.
38//
39
40#[derive(CandidType, Clone, Debug, Deserialize)]
41pub struct TopologyChildren {
42    pub parent_pid: Principal,
43    pub children: Vec<TopologyDirectChild>,
44}
45
46//
47// TopologyDirectChild
48//
49// Direct child node.
50//
51
52#[derive(CandidType, Clone, Debug, Deserialize)]
53pub struct TopologyDirectChild {
54    pub pid: Principal,
55    pub role: CanisterRole,
56}
57
58//
59// TopologyPathNode
60//
61// Parent-path node.
62//
63
64#[derive(CandidType, Clone, Debug, Deserialize)]
65pub struct TopologyPathNode {
66    pub pid: Principal,
67    pub role: CanisterRole,
68    pub parent_pid: Option<Principal>,
69}