Beginning of `stack-next` refactor
-Refactoring the protocol stack into something similar to a runtime. -Handles merging handler builders which is placing the ground work for plugins in. - Increased metadata generation during compilation enables less ser/de during execution. - Goal is to have an O(1) time from incoming operation to calling handlers. - Decreased penalty for using the statically typed API from within your code, now avoids some allocation. # Changes - Added `GiteratedRuntime` which is to replace the current unified stack - Added `RuntimeBuilder` which does what the current `OperationHandlers` struct does, but much better. - Added `RuntimeMetadata` to store type metadata for new `Any` based internals - Refactored serde_json out of the internal operation handling
parent: tbd commit: 708dea4
1 | |
2 | |
3 | |
4 | |
5 | |
6 | use |
7 | , HashMap, Future, Deref, Pin, str FromStr, Arc, | Any
8 | ; |
9 | |
10 | use FutureExt; |
11 | use |
12 | , | OperationError
13 | |
14 | AuthenticationTokenRequest, Instance, RegisterAccountRequest, RepositoryCreateRequest, |
15 | , |
16 | |
17 | AnyObject, GiteratedObject, Object, ObjectRequest, ObjectRequestError, ObjectResponse, |
18 | , |
19 | , | ObjectBackend
20 | , |
21 | , |
22 | , |
23 | , | User
24 | , |
25 | ; |
26 | use GiteratedBackend; |
27 | use ; |
28 | use Value; |
29 | use HandlerState; |
30 | use |
31 | , |
32 | , | JoinHandle
33 | ; |
34 | use ; |
35 | use |
36 | HandleSettingUpdate, HandleSettingUpdatedFunction, HandleValueUpdate, |
37 | HandleValueUpdatedFunction, SettingUpdateKind, ValueUpdateKind, |
38 | ; |
39 | |
40 | |
41 | |
42 | object_name: String, |
43 | operation_name: String, |
44 | |
45 | |
46 | |
47 | name: String, |
48 | deserialize: , |
49 | |
50 | |
51 | |
52 | name: String, |
53 | deserialize: , |
54 | |
55 | |
56 | |
57 | name: String, |
58 | from_str: , |
59 | any_is_same: , |
60 | |
61 | |
62 | |
63 | name: String, |
64 | object_kind: String, |
65 | deserialize: , |
66 | any_is_same: , |
67 | serialize_success: |
68 | , |
69 | serialize_error: , |
70 | |
71 | |
72 | |
73 | operations: , |
74 | get_object: , |
75 | value_getters: , |
76 | settings_getter: , |
77 | settings: , |
78 | objects: , |
79 | operations_meta: , |
80 | value_updated: , |
81 | setting_updated: , |
82 | |
83 | |
84 | |
85 | |
86 | pub object_kind: String, |
87 | pub value_kind: String, |
88 | |
89 | |
90 | |
91 | |
92 | Self |
93 | operations: new, |
94 | get_object: Vec new, |
95 | value_updated: default, |
96 | setting_updated: default, |
97 | value_getters: default, |
98 | settings_getter: default, |
99 | settings: default, |
100 | objects: default, |
101 | operations_meta: default, |
102 | |
103 | |
104 | |
105 | |
106 | |
107 | |
108 | &mut self, |
109 | |
110 | // let object_name = O::object_name().to_string(); |
111 | // let operation_name = D::operation_name().to_string(); |
112 | |
113 | // self.operations_meta.insert( |
114 | // ObjectOperationPair { |
115 | // object_name: object_name.clone(), |
116 | // operation_name: operation_name.clone(), |
117 | // }, |
118 | // OperationMeta { |
119 | // name: operation_name, |
120 | // object_kind: object_name, |
121 | // deserialize: Box::new(|bytes| { |
122 | // Ok(Box::new(serde_json::from_slice::<D>(bytes).unwrap()) |
123 | // as Box<dyn Any + Send + Sync>) |
124 | // }), |
125 | // any_is_same: Box::new(|any_box| any_box.is::<D>()), |
126 | // }, |
127 | // ); |
128 | |
129 | |
130 | |
131 | let setting_meta = SettingMeta |
132 | name: name .to_string, |
133 | deserialize: Box new |
134 | Ok |
135 | , |
136 | ; |
137 | |
138 | self.settings.insert; |
139 | |
140 | self |
141 | |
142 | |
143 | |
144 | A, |
145 | O: GiteratedObject + Send + Sync + 'static, |
146 | D: + Send + Sync + 'static, |
147 | H: + Send + Sync + 'static + Clone, |
148 | > |
149 | &mut self, |
150 | handler: H, |
151 | |
152 | let object_name = handler.object_name .to_string; |
153 | let operation_name = handler.operation_name .to_string; |
154 | |
155 | let wrapped = new; |
156 | |
157 | let pair = ObjectOperationPair |
158 | object_name, |
159 | operation_name, |
160 | ; |
161 | |
162 | assert!; |
163 | |
164 | self.; |
165 | |
166 | self |
167 | |
168 | |
169 | |
170 | // let object_meta = ObjectMeta { |
171 | // name: O::object_name().to_string(), |
172 | // from_str: Box::new(|str| Ok(Box::new(O::from_str(&str).map_err(|_| ())?))), |
173 | |
174 | // }; |
175 | |
176 | // self.objects |
177 | // .insert(O::object_name().to_string(), object_meta); |
178 | |
179 | let closure = |
180 | async move |
181 | if from_str .is_ok |
182 | Ok |
183 | else |
184 | Err |
185 | |
186 | |
187 | .boxed |
188 | ; |
189 | |
190 | let wrapped = new; |
191 | |
192 | self.get_object.push; |
193 | |
194 | self |
195 | |
196 | |
197 | pub async |
198 | &self, |
199 | object: &O, |
200 | operation_name: &str, |
201 | operation: AnyOperation, |
202 | state: S, |
203 | operation_state: &StackOperationState, |
204 | |
205 | // TODO |
206 | let object = object.to_string; |
207 | let object_name = object_name .to_string; |
208 | |
209 | let object_meta = self |
210 | .objects |
211 | .get |
212 | .ok_or_else?; |
213 | |
214 | let object_box = .map_err?; |
215 | |
216 | let target_handler = ObjectOperationPair |
217 | object_name, |
218 | operation_name: operation_name.to_string, |
219 | ; |
220 | |
221 | let operation_meta = self |
222 | .operations_meta |
223 | .get |
224 | .ok_or_else?; |
225 | |
226 | let operation_box = |
227 | |
228 | .map_err?; |
229 | |
230 | if let Some = self.operations.get |
231 | handler |
232 | .handle |
233 | .await |
234 | else |
235 | Err |
236 | |
237 | |
238 | |
239 | pub async |
240 | &self, |
241 | instance: Instance, |
242 | request: ObjectRequest, |
243 | state: S, |
244 | operation_state: &StackOperationState, |
245 | |
246 | for handler in self.get_object.iter |
247 | if let Ok = handler |
248 | .handle |
249 | Box new as _, |
250 | Box new as _, |
251 | state.clone, |
252 | operation_state, |
253 | |
254 | .await |
255 | |
256 | return Ok; |
257 | |
258 | |
259 | |
260 | Err |
261 | |
262 | |
263 | |
264 | H: + Send + Sync + Clone + 'static, |
265 | O: GiteratedObject + Send + Sync, |
266 | V: + Send + Sync, |
267 | > |
268 | &mut self, |
269 | handler: H, |
270 | |
271 | let wrapper = new; |
272 | |
273 | assert! |
274 | .value_updated |
275 | .insert |
276 | .is_none; |
277 | |
278 | self |
279 | |
280 | |
281 | |
282 | H: + Send + Sync + Clone + 'static, |
283 | O: GiteratedObject + Send + Sync, |
284 | T: Setting + Send + Sync, |
285 | > |
286 | &mut self, |
287 | handler: H, |
288 | |
289 | let wrapper = new; |
290 | |
291 | assert! |
292 | .setting_updated |
293 | .insert |
294 | .is_none; |
295 | |
296 | self |
297 | |
298 | |
299 | |
300 | |
301 | O: GiteratedObject + Send + Sync + 'static, |
302 | V: + Send + Sync + 'static, |
303 | F: + Send + Sync + Clone + 'static, |
304 | |
305 | let object_name = handler.object_name .to_string; |
306 | let value_name = value_name .to_string; |
307 | |
308 | let wrapped = new; |
309 | |
310 | assert! |
311 | .value_getters |
312 | .insert |
313 | ValueGetter |
314 | object_type: object_name, |
315 | value_type: value_name |
316 | , |
317 | wrapped |
318 | |
319 | .is_none; |
320 | |
321 | self |
322 | |
323 | |
324 | |
325 | |
326 | O: GiteratedObject + Send + Sync + 'static, |
327 | F: + Send + Sync + Clone + 'static, |
328 | |
329 | let object_name = handler.object_name .to_string; |
330 | |
331 | let wrapped = new; |
332 | |
333 | assert!; |
334 | |
335 | self |
336 | |
337 | |
338 | |
339 | |
340 | |
341 | pub object_type: String, |
342 | pub value_type: String, |
343 | |
344 | |
345 | |
346 | |
347 | Self |
348 | object_type: object_name .to_string, |
349 | value_type: "any".to_string, |
350 | |
351 | |
352 | |
353 | |
354 | |
355 | |
356 | L, |
357 | O: GiteratedObject, |
358 | D: GiteratedOperation<O>, |
359 | S: Send + Sync + Clone, |
360 | >: Send + Sync |
361 | |
362 | ; |
363 | ; |
364 | |
365 | async |
366 | &self, |
367 | object: &O, |
368 | operation: D, |
369 | state: S, |
370 | operation_state: &StackOperationState, |
371 | ; |
372 | |
373 | |
374 | |
375 | |
376 | |
377 | F: FnMut( |
378 | &O, |
379 | D, |
380 | S, |
381 | ) -> |
382 | , |
383 | > + Send |
384 | + Sync |
385 | + Clone, |
386 | O: GiteratedObject + Send + Sync, |
387 | D: + 'static, |
388 | : Send, | Failure
389 | S: Send + Sync + Clone + 'static, |
390 | |
391 | |
392 | operation_name |
393 | |
394 | |
395 | |
396 | object_name |
397 | |
398 | |
399 | async |
400 | &self, |
401 | object: &O, |
402 | operation: D, |
403 | state: S, |
404 | _operation_state: &StackOperationState, |
405 | |
406 | self.clone .await |
407 | |
408 | |
409 | |
410 | |
411 | |
412 | |
413 | F: FnMut( |
414 | &O, |
415 | D, |
416 | S, |
417 | O1, |
418 | ) -> |
419 | , |
420 | > + Send |
421 | + Sync |
422 | + Clone, |
423 | O: GiteratedObject + Send + Sync, |
424 | D: + 'static + Send + Sync, |
425 | : Send, | Failure
426 | S: Send + Sync + Clone + 'static, |
427 | O1: , |
428 | |
429 | |
430 | operation_name |
431 | |
432 | |
433 | |
434 | object_name |
435 | |
436 | |
437 | async |
438 | &self, |
439 | object: &O, |
440 | operation: D, |
441 | state: S, |
442 | operation_state: &StackOperationState, |
443 | |
444 | let o1 = O1 from_state |
445 | .await |
446 | .map_err?; |
447 | self.clone .await |
448 | |
449 | |
450 | |
451 | |
452 | |
453 | |
454 | F: FnMut( |
455 | &O, |
456 | D, |
457 | S, |
458 | O1, |
459 | O2, |
460 | ) -> |
461 | , |
462 | > + Send |
463 | + Sync |
464 | + Clone, |
465 | O: GiteratedObject + Send + Sync, |
466 | D: + 'static + Send + Sync, |
467 | : Send, | Failure
468 | S: Send + Sync + Clone + 'static, |
469 | O1: , |
470 | O2: , |
471 | |
472 | |
473 | operation_name |
474 | |
475 | |
476 | |
477 | object_name |
478 | |
479 | |
480 | async |
481 | &self, |
482 | object: &O, |
483 | operation: D, |
484 | state: S, |
485 | operation_state: &StackOperationState, |
486 | |
487 | let o1 = O1 from_state |
488 | .await |
489 | .map_err?; |
490 | let o2 = O2 from_state |
491 | .await |
492 | .map_err?; |
493 | self.clone .await |
494 | |
495 | |
496 | |
497 | |
498 | |
499 | |
500 | F: FnMut( |
501 | &O, |
502 | D, |
503 | S, |
504 | O1, |
505 | O2, |
506 | O3, |
507 | ) -> |
508 | , |
509 | > + Send |
510 | + Sync |
511 | + Clone, |
512 | O: GiteratedObject + Send + Sync, |
513 | D: + 'static + Send + Sync, |
514 | : Send, | Failure
515 | S: Send + Sync + Clone + 'static, |
516 | O1: , |
517 | O2: , |
518 | O3: , |
519 | |
520 | |
521 | operation_name |
522 | |
523 | |
524 | |
525 | object_name |
526 | |
527 | |
528 | async |
529 | &self, |
530 | object: &O, |
531 | operation: D, |
532 | state: S, |
533 | operation_state: &StackOperationState, |
534 | |
535 | let o1 = O1 from_state |
536 | .await |
537 | .map_err?; |
538 | let o2 = O2 from_state |
539 | .await |
540 | .map_err?; |
541 | let o3 = O3 from_state |
542 | .await |
543 | .map_err?; |
544 | self.clone .await |
545 | |
546 | |
547 | |
548 | |
549 | func: |
550 | dyn Fn( |
551 | , |
552 | , |
553 | S, |
554 | StackOperationState, |
555 | ) |
556 | -> |
557 | + Send |
558 | + Sync, |
559 | >, |
560 | object_name: String, |
561 | |
562 | |
563 | |
564 | |
565 | A, |
566 | O: GiteratedObject + Send + Sync + 'static, |
567 | D: + 'static, |
568 | F: + Send + Sync + 'static + Clone, |
569 | > |
570 | handler: F, |
571 | |
572 | let handler = new; |
573 | Self |
574 | func: Box new |
575 | let handler = handler.clone; |
576 | async move |
577 | let handler = handler.clone; |
578 | let object: = object.downcast .unwrap; |
579 | let operation: = operation.downcast .unwrap; |
580 | |
581 | let result = handler |
582 | .handle |
583 | .await; |
584 | result |
585 | .map |
586 | .map_err |
587 | => | Operation
588 | Operation |
589 | |
590 | => | Internal
591 | Internal |
592 | |
593 | => Unhandled, | Unhandled
594 | |
595 | |
596 | .boxed |
597 | , |
598 | object_name: object_name .to_string, |
599 | |
600 | |
601 | |
602 | async |
603 | &self, |
604 | object: , |
605 | operation: , |
606 | state: S, |
607 | operation_state: &StackOperationState, |
608 | |
609 | .await |
610 | |
611 | |
612 | |
613 | |
614 | |
615 | Sized + Clone + Send |
616 | |
617 | type Error: Serialize + DeserializeOwned; |
618 | |
619 | async |
620 | object: &O, |
621 | operation: &D, |
622 | state: &StackOperationState, |
623 | ; |
624 | |
625 | |
626 | |
627 | |
628 | for BackendWrapper |
629 | |
630 | type Error = ; |
631 | |
632 | async |
633 | _object: &O, |
634 | _operation: &D, |
635 | state: &StackOperationState, |
636 | |
637 | Ok |
638 | |
639 | |
640 | |
641 | |
642 | |
643 | for StackOperationState |
644 | |
645 | type Error = ; |
646 | |
647 | async |
648 | _object: &O, |
649 | _operation: &D, |
650 | state: &StackOperationState, |
651 | |
652 | Ok |
653 | |
654 | |
655 | |
656 | |
657 | |
658 | for AuthenticatedUser |
659 | |
660 | type Error = ; |
661 | |
662 | async |
663 | _object: &O, |
664 | _operation: &D, |
665 | state: &StackOperationState, |
666 | |
667 | state |
668 | .user |
669 | .clone |
670 | .ok_or_else |
671 | |
672 | |
673 | |
674 | |
675 | |
676 | for AuthenticatedInstance |
677 | |
678 | type Error = ; |
679 | |
680 | async |
681 | _object: &O, |
682 | _operation: &D, |
683 | state: &StackOperationState, |
684 | |
685 | state |
686 | .instance |
687 | .clone |
688 | .ok_or_else |
689 | |
690 | |
691 | |
692 | |
693 | |
694 | T: + Send + Sync, |
695 | O: GiteratedObject + Sync, |
696 | D: + Send + Sync, |
697 | > |
698 | |
699 | type Error = ; |
700 | |
701 | async |
702 | object: &O, |
703 | operation: &D, |
704 | state: &StackOperationState, |
705 | |
706 | Ok |
707 | |
708 | |
709 | |
710 | |
711 | ; |
712 | |
713 | |
714 | ; |
715 | |
716 | |
717 | |
718 | async |
719 | &self, |
720 | authorize_for: &O, |
721 | state: &StackOperationState, |
722 | ; |
723 | |
724 | |
725 | |
726 | |
727 | O: GiteratedObject + Send + Sync + Debug, |
728 | V: + Send + Sync, |
729 | > |
730 | |
731 | async |
732 | &self, |
733 | authorize_for: &O, |
734 | operation_state: &StackOperationState, |
735 | |
736 | Ok |
737 | .giterated_backend |
738 | . |
739 | .await |
740 | .is_ok |
741 | |
742 | |
743 | |
744 | |
745 | |
746 | async |
747 | &self, |
748 | authorize_for: &User, |
749 | operation_state: &StackOperationState, |
750 | |
751 | let authenticated_user = operation_state |
752 | .user |
753 | .as_ref |
754 | .ok_or_else?; |
755 | |
756 | Ok |
757 | |
758 | |
759 | |
760 | |
761 | |
762 | async |
763 | &self, |
764 | authorize_for: &User, |
765 | operation_state: &StackOperationState, |
766 | |
767 | let authenticated_user = operation_state |
768 | .user |
769 | .as_ref |
770 | .ok_or_else?; |
771 | |
772 | Ok |
773 | |
774 | |
775 | |
776 | |
777 | |
778 | async |
779 | &self, |
780 | authorize_for: &Repository, |
781 | operation_state: &StackOperationState, |
782 | |
783 | let authenticated_user = operation_state |
784 | .user |
785 | .as_ref |
786 | .ok_or_else?; |
787 | |
788 | let mut object = operation_state |
789 | .giterated_backend |
790 | . |
791 | .await |
792 | .map_err?; |
793 | |
794 | let access_list = object |
795 | . |
796 | .await |
797 | .map_err?; |
798 | |
799 | if access_list |
800 | .0 |
801 | .iter |
802 | .find |
803 | .is_some |
804 | |
805 | Ok |
806 | else |
807 | Ok |
808 | |
809 | |
810 | |
811 | |
812 | |
813 | |
814 | async |
815 | &self, |
816 | authorize_for: &Repository, |
817 | operation_state: &StackOperationState, |
818 | |
819 | let authenticated_user = operation_state |
820 | .user |
821 | .as_ref |
822 | .ok_or_else?; |
823 | |
824 | let mut object = operation_state |
825 | .giterated_backend |
826 | . |
827 | .await |
828 | .map_err?; |
829 | |
830 | let access_list = object |
831 | . |
832 | .await |
833 | .map_err?; |
834 | |
835 | if access_list |
836 | .0 |
837 | .iter |
838 | .find |
839 | .is_some |
840 | |
841 | Ok |
842 | else |
843 | Ok |
844 | |
845 | |
846 | |
847 | |
848 | |
849 | |
850 | async |
851 | &self, |
852 | authorize_for: &Instance, |
853 | state: &StackOperationState, |
854 | |
855 | if state.our_instance == *authorize_for |
856 | Ok |
857 | else |
858 | Ok |
859 | |
860 | |
861 | |
862 | |
863 | |
864 | |
865 | async |
866 | &self, |
867 | authorize_for: &Instance, |
868 | state: &StackOperationState, |
869 | |
870 | if state.our_instance == *authorize_for |
871 | Ok |
872 | else |
873 | Ok |
874 | |
875 | |
876 | |
877 | |
878 | |
879 | |
880 | async |
881 | &self, |
882 | authorize_for: &Instance, |
883 | state: &StackOperationState, |
884 | |
885 | if state.our_instance == *authorize_for |
886 | Ok |
887 | else |
888 | Ok |
889 | |
890 | |
891 | |
892 | |
893 | |
894 | |
895 | type Error = ; |
896 | |
897 | async |
898 | object: &User, |
899 | operation: &A, |
900 | state: &StackOperationState, |
901 | |
902 | let authenticated = from_state .await?; |
903 | |
904 | match operation.authorize .await |
905 | Ok => |
906 | assert!; |
907 | |
908 | Err => return Err, |
909 | ; |
910 | |
911 | Ok |
912 | |
913 | |
914 | |
915 | |
916 | |
917 | for AuthorizedInstance |
918 | |
919 | type Error = ; |
920 | |
921 | async |
922 | object: &Instance, |
923 | operation: &A, |
924 | state: &StackOperationState, |
925 | |
926 | let authenticated = from_state .await?; |
927 | |
928 | match operation.authorize .await |
929 | Ok => |
930 | assert!; |
931 | |
932 | Err => return Err, |
933 | ; |
934 | |
935 | Ok |
936 | |
937 | |
938 | |
939 | // #[async_trait::async_trait> FromOperationState for Option<T> { |
940 | // type Error = (); |
941 | |
942 | // async fn from_state(state: &StackOperationState) -> Result<Option<T>, OperationError<()>> { |
943 | // Ok(T::from_state(] |
944 | // impl<T: FromOperationStatestate).await.ok()) |
945 | // } |
946 | // } |
947 | |
948 | |
949 | |
950 | pub our_instance: Instance, |
951 | pub giterated_backend: BackendWrapper, |
952 | pub instance: , |
953 | pub user: , |
954 | |
955 | |
956 | |
957 | ; |
958 | |
959 | |
960 | |
961 | AuthenticatedInstance |
962 | |
963 | |
964 | |
965 | |
966 | type Target = Instance; |
967 | |
968 | |
969 | &self.0 |
970 | |
971 | |
972 | |
973 | |
974 | ; |
975 | |
976 | |
977 | |
978 | AuthenticatedUser |
979 | |
980 | |
981 | |
982 | |
983 | type Target = User; |
984 | |
985 | |
986 | &self.0 |
987 | |
988 | |
989 | |
990 | |
991 | |
992 | sender: |
993 | , |
994 | WrappedOperation, |
995 | )>, |
996 | task: , |
997 | |
998 | |
999 | |
1000 | object: AnyObject, |
1001 | operation_payload: AnyOperation, |
1002 | operation_name: String, |
1003 | state: StackOperationState, |
1004 | |
1005 | |
1006 | |
1007 | |
1008 | // Spawn listener task |
1009 | |
1010 | let = |
1011 | , |
1012 | WrappedOperation, |
1013 | )>; |
1014 | |
1015 | let task = spawn |
1016 | while let Some = recv.recv .await |
1017 | let raw_result = backend |
1018 | .object_operation |
1019 | message.object, |
1020 | &message.operation_name, |
1021 | message.operation_payload, |
1022 | &message.state, |
1023 | |
1024 | .await; |
1025 | |
1026 | responder.send .unwrap; |
1027 | |
1028 | error!; |
1029 | ; |
1030 | |
1031 | Self |
1032 | sender: send, |
1033 | task: new, |
1034 | |
1035 | |
1036 | |
1037 | pub async |
1038 | let = channel; |
1039 | |
1040 | self.sender |
1041 | .send |
1042 | .await |
1043 | .map_err?; |
1044 | |
1045 | match response.await |
1046 | Ok => Ok, |
1047 | Err => Err, |
1048 | |
1049 | |
1050 | |
1051 | |
1052 | use Debug; |
1053 | |
1054 | |
1055 | |
1056 | async |
1057 | &self, |
1058 | object: O, |
1059 | operation: &str, |
1060 | payload: D, |
1061 | operation_state: &StackOperationState, |
1062 | |
1063 | |
1064 | O: GiteratedObject + Debug, |
1065 | D: + Debug, |
1066 | |
1067 | let operation = WrappedOperation |
1068 | object: AnyObject, |
1069 | operation_name: operation.to_string, |
1070 | operation_payload: AnyOperation, |
1071 | state: operation_state.clone, |
1072 | ; |
1073 | |
1074 | let raw_result = self.call .await; |
1075 | |
1076 | match raw_result |
1077 | Ok => Ok |
1078 | .map_err?, |
1079 | Err => match err |
1080 | => | Internal
1081 | warn! |
1082 | "Internal Error: {:?}", |
1083 | Internal |
1084 | ; |
1085 | |
1086 | Err |
1087 | |
1088 | => Err, | Unhandled
1089 | => Err | Operation
1090 | from_value |
1091 | .map_err?, |
1092 | , |
1093 | , |
1094 | |
1095 | |
1096 | |
1097 | async |
1098 | &self, |
1099 | object_str: &str, |
1100 | operation_state: &StackOperationState, |
1101 | |
1102 | let operation = WrappedOperation |
1103 | object: AnyObject, |
1104 | operation_name: operation_name .to_string, |
1105 | operation_payload: AnyOperation |
1106 | unwrap, | to_value .
1107 | , |
1108 | state: operation_state.clone, |
1109 | ; |
1110 | |
1111 | let raw_result = self.call .await; |
1112 | |
1113 | let object: ObjectResponse = match raw_result |
1114 | Ok => Ok |
1115 | .map_err?, |
1116 | Err => match err |
1117 | => | Internal
1118 | warn! |
1119 | "Internal Error: {:?}", |
1120 | Internal |
1121 | ; |
1122 | |
1123 | Err |
1124 | |
1125 | => Err, | Unhandled
1126 | => Err | Operation
1127 | from_value |
1128 | .map_err?, |
1129 | , |
1130 | , |
1131 | ?; |
1132 | |
1133 | unsafe |
1134 | Ok |
1135 | from_str |
1136 | .map_err?, |
1137 | self.clone, |
1138 | |
1139 | |
1140 | |
1141 | |
1142 |