canic_core/ops/storage/
pool.rs1pub use crate::model::memory::pool::{CanisterPoolEntry, CanisterPoolStatus, CanisterPoolView};
2
3use crate::types::Cycles;
4use crate::{cdk::types::Principal, ids::CanisterRole, model::memory::pool::CanisterPool};
5
6pub struct CanisterPoolStorageOps;
12
13impl CanisterPoolStorageOps {
14 pub fn register(
15 pid: Principal,
16 cycles: Cycles,
17 status: CanisterPoolStatus,
18 role: Option<CanisterRole>,
19 parent: Option<Principal>,
20 module_hash: Option<Vec<u8>>,
21 ) {
22 CanisterPool::register(pid, cycles, status, role, parent, module_hash);
23 }
24
25 #[must_use]
26 pub fn get(pid: Principal) -> Option<CanisterPoolEntry> {
27 CanisterPool::get(pid)
28 }
29
30 #[must_use]
31 pub fn update(pid: Principal, entry: CanisterPoolEntry) -> bool {
32 CanisterPool::update(pid, entry)
33 }
34
35 #[must_use]
36 pub fn pop_ready() -> Option<(Principal, CanisterPoolEntry)> {
37 CanisterPool::pop_ready()
38 }
39
40 #[must_use]
41 pub fn contains(pid: &Principal) -> bool {
42 CanisterPool::contains(pid)
43 }
44
45 #[must_use]
46 pub fn take(pid: &Principal) -> Option<CanisterPoolEntry> {
47 CanisterPool::take(pid)
48 }
49
50 #[must_use]
51 pub fn export() -> CanisterPoolView {
52 CanisterPool::export()
53 }
54
55 #[must_use]
56 pub fn len() -> u64 {
57 CanisterPool::len()
58 }
59}