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 | use ; |
2 | |
3 | use |
4 | , | DecodeRsaPrivateKey
5 | , | SigningKey
6 | , | Sha256
7 | , |
8 | RsaPrivateKey, |
9 | ; |
10 | use ; |
11 | use Value; |
12 | |
13 | use crate:: |
14 | , | Instance
15 | , | GiteratedMessage
16 | , |
17 | , |
18 | , | User
19 | ; |
20 | |
21 | |
22 | |
23 | pub user: User, |
24 | pub generated_for: Instance, |
25 | pub exp: u64, |
26 | |
27 | |
28 | |
29 | |
30 | pub source: , |
31 | pub message: , |
32 | |
33 | |
34 | |
35 | |
36 | pub source: , |
37 | pub object: String, |
38 | pub operation: String, |
39 | pub payload: , |
40 | |
41 | |
42 | |
43 | |
44 | let payload = .unwrap; |
45 | GiteratedMessage |
46 | object: AnyObject, |
47 | operation: self.operation, |
48 | payload: AnyOperation, |
49 | |
50 | |
51 | |
52 | let payload = .unwrap; |
53 | GiteratedMessage |
54 | object: AnyObject, |
55 | operation: self.operation, |
56 | payload: AnyOperationV2, |
57 | |
58 | |
59 | |
60 | |
61 | |
62 | ; |
63 | |
64 | |
65 | |
66 | ; |
67 | |
68 | |
69 | |
70 | |
71 | A: AuthenticationSourceProvider, |
72 | |
73 | |
74 | vec! |
75 | |
76 | |
77 | |
78 | |
79 | |
80 | A: AuthenticationSourceProvider, |
81 | B: AuthenticationSourceProvider, |
82 | |
83 | |
84 | let = self; |
85 | |
86 | vec! |
87 | |
88 | |
89 | |
90 | |
91 | |
92 | Self |
93 | source: vec!, |
94 | message, |
95 | |
96 | |
97 | |
98 | |
99 | &mut self, |
100 | authentication: , |
101 | |
102 | self.source.push; |
103 | |
104 | |
105 | |
106 | let payload = to_vec .unwrap; |
107 | |
108 | AuthenticatedPayload |
109 | object: self.message.object.to_string, |
110 | operation: self.message.operation, |
111 | source: self |
112 | .source |
113 | .drain |
114 | .map |
115 | .flatten |
116 | ., |
117 | payload, |
118 | |
119 | |
120 | |
121 | |
122 | |
123 | |
124 | |
125 | |
126 | pub user: User, |
127 | pub token: UserAuthenticationToken, |
128 | |
129 | |
130 | |
131 | |
132 | User |
133 | user: self.user.clone, |
134 | token: self.token.clone, |
135 | |
136 | |
137 | |
138 | |
139 | |
140 | |
141 | pub instance: Instance, |
142 | pub private_key: String, |
143 | |
144 | |
145 | |
146 | |
147 | let mut rng = thread_rng; |
148 | |
149 | let private_key = from_pkcs1_pem .unwrap; |
150 | let signing_key = new; |
151 | let signature = signing_key.sign_with_rng; |
152 | |
153 | Instance |
154 | instance: self.instance.clone, |
155 | // TODO: Actually parse signature from private key |
156 | signature: InstanceSignature, |
157 | |
158 | |
159 | |
160 | |
161 | |
162 | |
163 | ; |
164 | |
165 | |
166 | |
167 | Self |
168 | |
169 | |
170 | |
171 | |
172 | |
173 | self.0.clone |
174 | |
175 | |
176 | |
177 | |
178 | |
179 | &self.0 |
180 | |
181 | |
182 | |
183 | |
184 | ; |
185 | |
186 | |
187 | |
188 | &self.0 |
189 | |
190 | |
191 | |
192 | |
193 | |
194 | User |
195 | user: User, |
196 | token: UserAuthenticationToken, |
197 | , |
198 | Instance |
199 | instance: Instance, |
200 | signature: InstanceSignature, |
201 | , |
202 | |
203 |