`giterated_cache` initial implementation
# Giterated Stack - Added the ability for dynamic substack handlers to exist for operations relevant to caching. - Added type metadata to the dynamic types. # Giterated Cache - Created - Implemented caching and fetching from cache. Hell fucking yes!!!! It works so good. Are you snooping in the commit logs because you're curious about the history of giterated? Cool that it got so big... tell me I say hi :)
parent: tbd commit: 86afeef
1 | use ; |
2 | |
3 | use ; |
4 | use |
5 | , | GiteratedObject
6 | , | GiteratedOperation
7 | , | Setting
8 | , |
9 | ; |
10 | use Value; |
11 | use trace; |
12 | |
13 | use crate:: |
14 | AnyFailure, AnyObject, AnyOperation, AnySetting, AnySuccess, AnyValue, GiteratedStack, |
15 | ObjectOperationPair, ObjectSettingPair, ObjectValuePair, StackOperationState, |
16 | ; |
17 | |
18 | /// Stores runtime metadata for all in-use Giterated protocol types. |
19 | |
20 | |
21 | pub objects: , |
22 | pub operations: , |
23 | pub values: , |
24 | pub settings: , |
25 | |
26 | |
27 | |
28 | |
29 | let object_name = object_name .to_string; |
30 | |
31 | let object_meta = ; |
32 | |
33 | if self.objects.insert .is_some |
34 | trace! |
35 | "Registration of object {} overwrote previous registration.", |
36 | object_name |
37 | ; |
38 | else |
39 | trace! |
40 | |
41 | |
42 | |
43 | |
44 | &mut self, |
45 | |
46 | let _object_name = object_name .to_string; |
47 | let _operation_name = operation_name .to_string; |
48 | |
49 | if self |
50 | .operations |
51 | .insert |
52 | , |
53 | , |
54 | |
55 | .is_some |
56 | |
57 | trace! |
58 | "Registration of object operation {}<{}> overwrote previous registration.", |
59 | , | operation_name
60 | object_name |
61 | ; |
62 | else |
63 | trace! |
64 | "Registration of object operation {}<{}>.", |
65 | , | operation_name
66 | object_name |
67 | |
68 | |
69 | |
70 | |
71 | |
72 | O: GiteratedObject + 'static, |
73 | V: + 'static, |
74 | > |
75 | &mut self, |
76 | |
77 | if self |
78 | .values |
79 | .insert |
80 | .is_some |
81 | |
82 | trace! |
83 | "Registration of value <{}>::{} overwrote previous registration.", |
84 | , | object_name
85 | value_name |
86 | ; |
87 | else |
88 | trace! |
89 | "Registration of value <{}>::{}.", |
90 | , | object_name
91 | value_name |
92 | ; |
93 | |
94 | |
95 | |
96 | |
97 | if self |
98 | .settings |
99 | .insert |
100 | , |
101 | , |
102 | |
103 | .is_some |
104 | |
105 | trace! |
106 | "Registration of setting {} overwrote previous registration.", |
107 | name |
108 | ; |
109 | else |
110 | trace!; |
111 | |
112 | |
113 | |
114 | |
115 | self.objects.extend; |
116 | self.operations.extend; |
117 | self.values.extend; |
118 | self.settings.extend; |
119 | |
120 | |
121 | |
122 | |
123 | pub name: String, |
124 | pub deserialize: fn , |
125 | pub serialize: fn , |
126 | pub typed_get: fn , |
127 | pub is_get_value_typed: fn , |
128 | |
129 | |
130 | |
131 | ; |
132 | ; |
133 | ; |
134 | ; |
135 | ; |
136 | |
137 | |
138 | |
139 | |
140 | to_string | value_name .
141 | |
142 | |
143 | |
144 | Ok |
145 | |
146 | |
147 | |
148 | let value = value. .unwrap; |
149 | |
150 | to_vec |
151 | |
152 | |
153 | |
154 | Box new |
155 | ty: Default default, |
156 | |
157 | |
158 | |
159 | |
160 | typed_get_value. |
161 | |
162 | |
163 | |
164 | |
165 | |
166 | Self |
167 | name: name, |
168 | deserialize: deserialize, |
169 | serialize: serialize, |
170 | typed_get: typed_get, |
171 | is_get_value_typed: is_get_value_typed, |
172 | |
173 | |
174 | |
175 | |
176 | |
177 | pub name: String, |
178 | pub object_kind: String, |
179 | pub deserialize: fn , |
180 | pub any_is_same: fn , |
181 | pub serialize_success: fn , |
182 | pub serialize_error: fn , |
183 | |
184 | |
185 | |
186 | ; |
187 | ; |
188 | ; |
189 | ; |
190 | ; |
191 | |
192 | |
193 | |
194 | |
195 | : 'static, | Failure
196 | : 'static, | Success
197 | O: GiteratedObject, |
198 | D: + 'static, |
199 | |
200 | |
201 | to_string | operation_name .
202 | |
203 | |
204 | |
205 | Ok |
206 | |
207 | |
208 | |
209 | let to_serialize = success.0. .unwrap; |
210 | to_vec |
211 | |
212 | |
213 | |
214 | let to_serialize = failure.0. .unwrap; |
215 | to_vec |
216 | |
217 | |
218 | |
219 | other. |
220 | |
221 | |
222 | |
223 | |
224 | |
225 | Self |
226 | name: name, |
227 | deserialize: deserialize, |
228 | serialize_success: serialize_success, |
229 | serialize_error: serialize_failure, |
230 | object_kind: object_name .to_string, |
231 | any_is_same: any_is_same, |
232 | |
233 | |
234 | |
235 | |
236 | |
237 | pub name: String, |
238 | pub to_str: , |
239 | pub from_str: , |
240 | pub any_is_same: fn , |
241 | |
242 | |
243 | |
244 | ; |
245 | ; |
246 | |
247 | |
248 | |
249 | |
250 | to_string | object_name .
251 | |
252 | |
253 | |
254 | other. |
255 | |
256 | |
257 | |
258 | |
259 | |
260 | Self |
261 | name: name, |
262 | from_str: Box new |
263 | let object = from_str .map_err?; |
264 | |
265 | Ok |
266 | , |
267 | to_str: Box new |
268 | let object: &I = source.downcast_ref .unwrap; |
269 | |
270 | object.to_string |
271 | , |
272 | any_is_same: any_is_same, |
273 | |
274 | |
275 | |
276 | |
277 | |
278 | pub name: String, |
279 | pub deserialize: fn , |
280 | pub serialize: fn , |
281 | pub setting_updated: fn |
282 | AnyObject, |
283 | AnySetting, |
284 | , |
285 | &StackOperationState, |
286 | , |
287 | |
288 | |
289 | |
290 | ; |
291 | ; |
292 | ; |
293 | |
294 | object: AnyObject, |
295 | setting: AnySetting, |
296 | stack: , |
297 | operation_state: &StackOperationState, |
298 | ; |
299 | |
300 | |
301 | |
302 | |
303 | to_string | name .
304 | |
305 | |
306 | |
307 | Ok |
308 | |
309 | |
310 | |
311 | to_value |
312 | |
313 | |
314 | |
315 | object: AnyObject, |
316 | setting: AnySetting, |
317 | stack: , |
318 | operation_state: &StackOperationState, |
319 | |
320 | async move |
321 | stack |
322 | .setting_update |
323 | object.unwrap .clone, | .
324 | setting.unwrap .clone, | .
325 | operation_state, |
326 | |
327 | .await |
328 | |
329 | .boxed_local |
330 | |
331 | |
332 | |
333 | |
334 | |
335 | Self |
336 | name: name, |
337 | deserialize: deserialize, |
338 | serialize: serialize, |
339 | setting_updated: setting_updated, |
340 | |
341 | |
342 | |
343 |