1use serde::Deserialize;
7
8#[cfg_attr(
15 doc,
16 doc = "EntityCatalogCounts\n\nCompact count metadata for one SHOW ENTITIES row."
17)]
18#[derive(Clone, Debug, Deserialize, Eq, PartialEq)]
19pub struct EntityCatalogCounts {
20 columns: u32,
21 indexes: u32,
22 relations: u32,
23 schema_version: u32,
24}
25
26impl EntityCatalogCounts {
27 #[must_use]
29 pub const fn new(columns: u32, indexes: u32, relations: u32, schema_version: u32) -> Self {
30 Self {
31 columns,
32 indexes,
33 relations,
34 schema_version,
35 }
36 }
37}
38
39#[cfg_attr(
40 doc,
41 doc = "EntityCatalogDescription\n\nRuntime catalog entry for one accepted entity."
42)]
43#[derive(Clone, Debug, Deserialize, Eq, PartialEq, serde::Serialize)]
44#[cfg_attr(not(target_family = "wasm"), derive(ic_wire::Wire))]
45pub struct EntityCatalogDescription {
46 entity_name: String,
47 entity_path: String,
48 store_path: String,
49 storage: String,
50 columns: u32,
51 indexes: u32,
52 relations: u32,
53 schema_version: u32,
54}
55
56impl EntityCatalogDescription {
57 #[must_use]
59 pub const fn new(
60 entity_name: String,
61 entity_path: String,
62 store_path: String,
63 storage: String,
64 counts: EntityCatalogCounts,
65 ) -> Self {
66 Self {
67 entity_name,
68 entity_path,
69 store_path,
70 storage,
71 columns: counts.columns,
72 indexes: counts.indexes,
73 relations: counts.relations,
74 schema_version: counts.schema_version,
75 }
76 }
77
78 #[must_use]
80 pub const fn entity_name(&self) -> &str {
81 self.entity_name.as_str()
82 }
83
84 #[must_use]
86 pub const fn entity_path(&self) -> &str {
87 self.entity_path.as_str()
88 }
89
90 #[must_use]
92 pub const fn store_path(&self) -> &str {
93 self.store_path.as_str()
94 }
95
96 #[must_use]
98 pub const fn storage(&self) -> &str {
99 self.storage.as_str()
100 }
101
102 #[must_use]
104 pub const fn columns(&self) -> u32 {
105 self.columns
106 }
107
108 #[must_use]
110 pub const fn indexes(&self) -> u32 {
111 self.indexes
112 }
113
114 #[must_use]
116 pub const fn relations(&self) -> u32 {
117 self.relations
118 }
119
120 #[must_use]
122 pub const fn schema_version(&self) -> u32 {
123 self.schema_version
124 }
125}
126
127#[cfg_attr(
134 doc,
135 doc = "StoreCatalogDescription\n\nRuntime catalog entry for one registered store."
136)]
137#[derive(Clone, Debug, Deserialize, Eq, PartialEq, serde::Serialize)]
138#[cfg_attr(not(target_family = "wasm"), derive(ic_wire::Wire))]
139pub struct StoreCatalogDescription {
140 store_path: String,
141 storage: String,
142}
143
144impl StoreCatalogDescription {
145 #[must_use]
147 pub const fn new(store_path: String, storage: String) -> Self {
148 Self {
149 store_path,
150 storage,
151 }
152 }
153
154 #[must_use]
156 pub const fn store_path(&self) -> &str {
157 self.store_path.as_str()
158 }
159
160 #[must_use]
162 pub const fn storage(&self) -> &str {
163 self.storage.as_str()
164 }
165}
166
167#[cfg_attr(
174 doc,
175 doc = "MemoryCatalogDescription\n\nRuntime catalog entry for one stable-memory allocation."
176)]
177#[derive(Clone, Debug, Deserialize, Eq, PartialEq, serde::Serialize)]
178#[cfg_attr(not(target_family = "wasm"), derive(ic_wire::Wire))]
179pub struct MemoryCatalogDescription {
180 tag: String,
181 memory_id: u8,
182 store_path: String,
183}
184
185impl MemoryCatalogDescription {
186 #[must_use]
188 pub const fn new(tag: String, memory_id: u8, store_path: String) -> Self {
189 Self {
190 tag,
191 memory_id,
192 store_path,
193 }
194 }
195
196 #[must_use]
198 pub const fn tag(&self) -> &str {
199 self.tag.as_str()
200 }
201
202 #[must_use]
204 pub const fn memory_id(&self) -> u8 {
205 self.memory_id
206 }
207
208 #[must_use]
210 pub const fn store_path(&self) -> &str {
211 self.store_path.as_str()
212 }
213}