Skip to main content

canic_core/dto/
cascade.rs

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