Skip to main content

canic_core/dto/
cascade.rs

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