Skip to main content

canic_core/dto/
cascade.rs

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