Skip to main content

canic_core/dto/
cascade.rs

1use crate::dto::{
2    prelude::*,
3    state::AppStateInput,
4    topology::{AppIndexArgs, SubnetIndexArgs},
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 app_index: Option<AppIndexArgs>,
17    pub subnet_index: Option<SubnetIndexArgs>,
18}
19
20//
21// TopologySnapshotInput
22//
23// Cascade topology snapshot.
24//
25
26#[derive(CandidType, Clone, Debug, Deserialize)]
27pub struct TopologySnapshotInput {
28    pub parents: Vec<TopologyPathNode>,
29    // Children keyed by parent pid.
30    pub children_map: Vec<TopologyChildren>,
31}
32
33//
34// TopologyChildren
35//
36// Parent-keyed child list.
37//
38
39#[derive(CandidType, Clone, Debug, Deserialize)]
40pub struct TopologyChildren {
41    pub parent_pid: Principal,
42    pub children: Vec<TopologyDirectChild>,
43}
44
45//
46// TopologyDirectChild
47//
48// Direct child node.
49//
50
51#[derive(CandidType, Clone, Debug, Deserialize)]
52pub struct TopologyDirectChild {
53    pub pid: Principal,
54    pub role: CanisterRole,
55}
56
57//
58// TopologyPathNode
59//
60// Parent-path node.
61//
62
63#[derive(CandidType, Clone, Debug, Deserialize)]
64pub struct TopologyPathNode {
65    pub pid: Principal,
66    pub role: CanisterRole,
67    pub parent_pid: Option<Principal>,
68}