Skip to main content

canic_core/dto/
topology.rs

1use crate::dto::{canister::CanisterInfo, prelude::*};
2
3///
4/// AppRegistryResponse
5///
6
7#[derive(CandidType, Clone, Debug, Deserialize, Serialize)]
8pub struct AppRegistryResponse(pub Vec<AppRegistryEntry>);
9
10///
11/// AppRegistryEntry
12///
13
14#[derive(CandidType, Clone, Debug, Deserialize, Serialize)]
15pub struct AppRegistryEntry {
16    pub subnet_pid: Principal,
17    pub root_pid: Principal,
18}
19
20///
21/// SubnetRegistryResponse
22///
23/// External view of the subnet registry.
24/// Each entry is identity-bearing (`pid`) and includes the full
25/// canister record payload.
26///
27
28#[derive(CandidType, Clone, Debug, Deserialize, Serialize)]
29pub struct SubnetRegistryResponse(pub Vec<SubnetRegistryEntry>);
30
31///
32/// SubnetRegistryEntry
33///
34/// Registry entry keyed by canister principal.
35/// The `role` is duplicated outside the record for convenient
36/// filtering and indexing by consumers.
37///
38
39#[derive(CandidType, Clone, Debug, Deserialize, Serialize)]
40pub struct SubnetRegistryEntry {
41    pub pid: Principal,
42    pub role: CanisterRole,
43    pub record: CanisterInfo,
44}
45
46///
47/// AppDirectoryArgs
48///
49
50#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
51pub struct AppDirectoryArgs(pub Vec<DirectoryEntryInput>);
52
53///
54/// SubnetDirectoryArgs
55///
56
57#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
58pub struct SubnetDirectoryArgs(pub Vec<DirectoryEntryInput>);
59
60///
61/// DirectoryEntryInput
62///
63
64#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
65pub struct DirectoryEntryInput {
66    pub role: CanisterRole,
67    pub pid: Principal,
68}
69
70///
71/// DirectoryEntryResponse
72///
73
74#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
75pub struct DirectoryEntryResponse {
76    pub role: CanisterRole,
77    pub pid: Principal,
78}