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)]
44pub struct EntityCatalogDescription {
45 entity_name: String,
46 entity_path: String,
47 store_path: String,
48 storage: String,
49 columns: u32,
50 indexes: u32,
51 relations: u32,
52 schema_version: u32,
53}
54
55impl EntityCatalogDescription {
56 #[must_use]
58 pub const fn new(
59 entity_name: String,
60 entity_path: String,
61 store_path: String,
62 storage: String,
63 counts: EntityCatalogCounts,
64 ) -> Self {
65 Self {
66 entity_name,
67 entity_path,
68 store_path,
69 storage,
70 columns: counts.columns,
71 indexes: counts.indexes,
72 relations: counts.relations,
73 schema_version: counts.schema_version,
74 }
75 }
76
77 #[must_use]
79 pub const fn entity_name(&self) -> &str {
80 self.entity_name.as_str()
81 }
82
83 #[must_use]
85 pub const fn entity_path(&self) -> &str {
86 self.entity_path.as_str()
87 }
88
89 #[must_use]
91 pub const fn store_path(&self) -> &str {
92 self.store_path.as_str()
93 }
94
95 #[must_use]
97 pub const fn storage(&self) -> &str {
98 self.storage.as_str()
99 }
100
101 #[must_use]
103 pub const fn columns(&self) -> u32 {
104 self.columns
105 }
106
107 #[must_use]
109 pub const fn indexes(&self) -> u32 {
110 self.indexes
111 }
112
113 #[must_use]
115 pub const fn relations(&self) -> u32 {
116 self.relations
117 }
118
119 #[must_use]
121 pub const fn schema_version(&self) -> u32 {
122 self.schema_version
123 }
124}
125
126#[cfg_attr(
133 doc,
134 doc = "StoreCatalogDescription\n\nRuntime catalog entry for one registered store."
135)]
136#[derive(Clone, Debug, Deserialize, Eq, PartialEq, serde::Serialize)]
137pub struct StoreCatalogDescription {
138 store_path: String,
139 storage: String,
140}
141
142impl StoreCatalogDescription {
143 #[must_use]
145 pub const fn new(store_path: String, storage: String) -> Self {
146 Self {
147 store_path,
148 storage,
149 }
150 }
151
152 #[must_use]
154 pub const fn store_path(&self) -> &str {
155 self.store_path.as_str()
156 }
157
158 #[must_use]
160 pub const fn storage(&self) -> &str {
161 self.storage.as_str()
162 }
163}
164
165#[cfg_attr(
172 doc,
173 doc = "MemoryCatalogDescription\n\nRuntime catalog entry for one stable-memory allocation."
174)]
175#[derive(Clone, Debug, Deserialize, Eq, PartialEq, serde::Serialize)]
176pub struct MemoryCatalogDescription {
177 tag: String,
178 memory_id: u8,
179 store_path: String,
180}
181
182impl MemoryCatalogDescription {
183 #[must_use]
185 pub const fn new(tag: String, memory_id: u8, store_path: String) -> Self {
186 Self {
187 tag,
188 memory_id,
189 store_path,
190 }
191 }
192
193 #[must_use]
195 pub const fn tag(&self) -> &str {
196 self.tag.as_str()
197 }
198
199 #[must_use]
201 pub const fn memory_id(&self) -> u8 {
202 self.memory_id
203 }
204
205 #[must_use]
207 pub const fn store_path(&self) -> &str {
208 self.store_path.as_str()
209 }
210}