Skip to main content

canic_core/dto/placement/
directory.rs

1use crate::dto::prelude::*;
2
3//
4// DirectoryRegistryEntry
5//
6
7#[derive(CandidType, Clone, Debug, Deserialize)]
8pub struct DirectoryRegistryEntry {
9    pub pool: String,
10    pub key_value: String,
11    pub status: DirectoryEntryStatusResponse,
12}
13
14//
15// DirectoryRegistryResponse
16//
17
18#[derive(CandidType, Clone, Debug, Deserialize)]
19pub struct DirectoryRegistryResponse(pub Vec<DirectoryRegistryEntry>);
20
21//
22// DirectoryEntryStatusResponse
23//
24
25#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq)]
26pub enum DirectoryEntryStatusResponse {
27    Pending {
28        owner_pid: Principal,
29        created_at: u64,
30        provisional_pid: Option<Principal>,
31    },
32    Bound {
33        instance_pid: Principal,
34        bound_at: u64,
35    },
36}
37
38//
39// DirectoryRecoveryResponse
40//
41
42#[derive(CandidType, Clone, Debug, Deserialize, Eq, PartialEq)]
43pub enum DirectoryRecoveryResponse {
44    Missing,
45    FreshPending {
46        owner_pid: Principal,
47        created_at: u64,
48        provisional_pid: Option<Principal>,
49    },
50    Bound {
51        instance_pid: Principal,
52        bound_at: u64,
53    },
54    RepairedToBound {
55        instance_pid: Principal,
56        bound_at: u64,
57    },
58    ReleasedStalePending {
59        owner_pid: Principal,
60        created_at: u64,
61        provisional_pid: Option<Principal>,
62        released_at: u64,
63    },
64}