Skip to main content

canic_core/dto/
topology.rs

1use crate::dto::{canister::CanisterInfo, prelude::*};
2
3//
4// AppRegistryResponse
5//
6
7#[derive(CandidType, Deserialize)]
8pub struct AppRegistryResponse(pub Vec<AppRegistryEntry>);
9
10//
11// AppRegistryEntry
12//
13
14#[derive(CandidType, Deserialize)]
15pub struct AppRegistryEntry {
16    pub subnet_pid: Principal,
17    pub root_pid: Principal,
18}
19
20//
21// SubnetRegistryResponse
22//
23// External subnet registry view.
24//
25
26#[derive(CandidType, Deserialize)]
27pub struct SubnetRegistryResponse(pub Vec<SubnetRegistryEntry>);
28
29//
30// SubnetRegistryEntry
31//
32// Subnet registry entry.
33//
34
35#[derive(CandidType, Deserialize)]
36pub struct SubnetRegistryEntry {
37    pub pid: Principal,
38    pub role: CanisterRole,
39    pub record: CanisterInfo,
40}
41
42//
43// AppIndexArgs
44//
45
46#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq)]
47pub struct AppIndexArgs(pub Vec<IndexEntryInput>);
48
49//
50// SubnetIndexArgs
51//
52
53#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq)]
54pub struct SubnetIndexArgs(pub Vec<IndexEntryInput>);
55
56//
57// IndexEntryInput
58//
59
60#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq)]
61pub struct IndexEntryInput {
62    pub role: CanisterRole,
63    pub pid: Principal,
64}
65
66//
67// IndexEntryResponse
68//
69
70#[derive(CandidType, Debug, Deserialize, Eq, PartialEq)]
71pub struct IndexEntryResponse {
72    pub role: CanisterRole,
73    pub pid: Principal,
74}