1use crate::{
17 cdk::types::Cycles,
18 dto::{prelude::*, rpc::RootRequestMetadata},
19};
20
21#[derive(CandidType, Clone, Debug, Deserialize)]
27pub struct CanisterPoolResponse {
28 pub entries: Vec<CanisterPoolEntry>,
29}
30
31#[derive(CandidType, Clone, Debug, Deserialize)]
36pub struct CanisterPoolEntry {
37 pub pid: Principal,
38 pub created_at: u64,
39 pub cycles: Cycles,
40 pub status: CanisterPoolStatus,
41 pub role: Option<CanisterRole>,
42 pub parent: Option<Principal>,
43 pub module_hash: Option<Vec<u8>>,
44}
45
46#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq)]
51pub enum CanisterPoolStatus {
52 PendingReset,
53 Ready,
54 Failed { reason: String },
55}
56
57#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq)]
65pub enum PoolAdminCommand {
66 CreateEmpty(CreateEmptyPoolRequest),
68
69 Recycle { pid: Principal },
71
72 ImportImmediate { pid: Principal },
74
75 ImportQueued { pids: Vec<Principal> },
77}
78
79#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq)]
84pub struct CreateEmptyPoolRequest {
85 #[serde(default)]
86 pub metadata: Option<RootRequestMetadata>,
87}
88
89#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq)]
95pub enum PoolAdminResponse {
96 Created { pid: Principal },
98
99 Recycled,
101
102 Imported,
104
105 QueuedImported { result: PoolBatchResult },
107
108 FailedRequeued { result: PoolBatchResult },
110}
111
112#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq)]
117pub struct PoolBatchResult {
118 pub total: u64,
119 pub added: u64,
120 pub requeued: u64,
121 pub skipped: u64,
122}