Giterated stack changeover, refactor still incomplete
parent: tbd commit: 8d40dfe
1 | use |
2 | , | OperationError
3 | |
4 | AnyObject, GiteratedObject, Object, ObjectRequest, ObjectRequestError, ObjectResponse, |
5 | , |
6 | , | ObjectBackend
7 | , |
8 | ; |
9 | use ; |
10 | use warn; |
11 | |
12 | use crate::; |
13 | |
14 | |
15 | |
16 | state: S, |
17 | handlers: , |
18 | |
19 | |
20 | |
21 | |
22 | Self |
23 | state, |
24 | handlers: new, |
25 | |
26 | |
27 | |
28 | |
29 | |
30 | |
31 | async |
32 | &self, |
33 | object: O, |
34 | operation: &str, |
35 | payload: D, |
36 | |
37 | |
38 | O: GiteratedObject + Debug, |
39 | D: + Debug, |
40 | |
41 | let serialized = |
42 | map_err?; | to_value .
43 | let object = object.to_string; |
44 | |
45 | if operation == operation_name |
46 | // We're doing an object request |
47 | let raw_result = self |
48 | .handlers |
49 | .resolve_object |
50 | AnyObject, |
51 | unwrap, | from_value .
52 | self.state.clone, |
53 | |
54 | .await; |
55 | |
56 | return match raw_result |
57 | Ok => Ok |
58 | .map_err?, |
59 | Err => match err |
60 | => | Internal
61 | warn! |
62 | "Internal Error: {:?}", |
63 | Internal |
64 | ; |
65 | |
66 | Err |
67 | |
68 | => Err, | Unhandled
69 | => Err | Operation
70 | from_slice |
71 | .map_err?, |
72 | , |
73 | , |
74 | ; |
75 | |
76 | |
77 | let raw_result = self |
78 | .handlers |
79 | .handle |
80 | &AnyObject, |
81 | operation, |
82 | AnyOperation, |
83 | self.state.clone, |
84 | |
85 | .await; |
86 | |
87 | match raw_result |
88 | Ok => Ok |
89 | .map_err?, |
90 | Err => match err |
91 | => | Internal
92 | warn! |
93 | "Internal Error: {:?}", |
94 | Internal |
95 | ; |
96 | |
97 | Err |
98 | |
99 | => Err, | Unhandled
100 | => Err | Operation
101 | from_slice |
102 | .map_err?, |
103 | , |
104 | , |
105 | |
106 | |
107 | |
108 | async |
109 | &self, |
110 | object_str: &str, |
111 | |
112 | let raw_result = self |
113 | .handlers |
114 | .resolve_object |
115 | AnyObject, |
116 | ObjectRequest, |
117 | self.state.clone, |
118 | |
119 | .await; |
120 | |
121 | let object: ObjectResponse = match raw_result |
122 | Ok => Ok |
123 | .map_err?, |
124 | Err => match err |
125 | => | Internal
126 | warn! |
127 | "Internal Error: {:?}", |
128 | Internal |
129 | ; |
130 | |
131 | Err |
132 | |
133 | => Err, | Unhandled
134 | => Err | Operation
135 | from_slice |
136 | .map_err?, |
137 | , |
138 | , |
139 | ?; |
140 | |
141 | unsafe |
142 | Ok |
143 | from_str |
144 | .map_err?, |
145 | self.clone, |
146 | |
147 | |
148 | |
149 | |
150 |