Giterated stack changeover, refactor still incomplete
parent: tbd commit: 8d40dfe
1 | |
2 | |
3 | use Arc; |
4 | |
5 | use OperationError; |
6 | use Instance; |
7 | use ; |
8 | use ObjectBackend; |
9 | use GiteratedOperation; |
10 | use Repository; |
11 | use User; |
12 | use GiteratedBackend; |
13 | use OperationHandlers; |
14 | use Debug; |
15 | use Mutex; |
16 | |
17 | use crate; |
18 | |
19 | use |
20 | repository_commit_before, repository_diff, repository_file_from_id, repository_get_setting, |
21 | repository_get_value, repository_info, repository_set_setting, user_get_repositories, |
22 | user_get_setting, user_get_value, user_set_setting, |
23 | ; |
24 | |
25 | |
26 | |
27 | |
28 | |
29 | |
30 | async |
31 | &self, |
32 | _object: O, |
33 | _operation: &str, |
34 | _payload: D, |
35 | |
36 | // We don't handle operations with this backend |
37 | Err |
38 | |
39 | |
40 | async |
41 | &self, |
42 | _object_str: &str, |
43 | |
44 | Err |
45 | |
46 | |
47 | |
48 | /// A backend implementation which attempts to resolve data from the instance's database. |
49 | |
50 | |
51 | pub(self) our_instance: Instance, |
52 | pub(self) user_backend: , |
53 | pub(self) repository_backend: , |
54 | |
55 | |
56 | |
57 | |
58 | instance: Instance, |
59 | user_backend: , |
60 | repository_backend: , |
61 | |
62 | Self |
63 | our_instance: instance, |
64 | user_backend, |
65 | repository_backend, |
66 | |
67 | |
68 | |
69 | |
70 | let mut handlers = default; |
71 | |
72 | handlers |
73 | .insert |
74 | .insert |
75 | .insert |
76 | .insert |
77 | .insert |
78 | .insert |
79 | .insert |
80 | .insert |
81 | .insert |
82 | .insert |
83 | .insert |
84 | . |
85 | . |
86 | .; |
87 | |
88 | new |
89 | |
90 | |
91 | |
92 | |
93 | |
94 | f.debug_struct .finish |
95 | |
96 | |
97 | |
98 | // TODO: These should be on the stack |
99 | // These tests verify that the essential handling of the database backend is |
100 | // functional and correct. |
101 | |
102 | |
103 | use ; |
104 | |
105 | use Error; |
106 | |
107 | use UserAuthenticationToken; |
108 | |
109 | use |
110 | AuthenticationTokenRequest, Instance, RegisterAccountRequest, RepositoryCreateRequest, |
111 | ; |
112 | |
113 | use ObjectBackend; |
114 | |
115 | use |
116 | Commit, Description, Repository, RepositoryCommitBeforeRequest, RepositoryDiff, |
117 | RepositoryDiffRequest, RepositoryFile, RepositoryFileFromIdRequest, |
118 | RepositoryFileInspectRequest, RepositorySummary, RepositoryTreeEntry, |
119 | ; |
120 | use AnySetting; |
121 | use ; |
122 | use ; |
123 | use GiteratedBackend; |
124 | use Value; |
125 | use Mutex; |
126 | |
127 | use crate; |
128 | |
129 | use DatabaseBackend; |
130 | ; |
131 | |
132 | |
133 | |
134 | async |
135 | assert_eq!; |
136 | |
137 | Ok |
138 | & to_vec .unwrap, |
139 | |
140 | .unwrap |
141 | |
142 | async |
143 | Ok |
144 | & to_vec .unwrap, |
145 | |
146 | .unwrap |
147 | |
148 | async |
149 | &mut self, |
150 | _user: &User, |
151 | _name: &str, |
152 | _setting: &Value, |
153 | |
154 | Ok |
155 | |
156 | async |
157 | Ok |
158 | |
159 | async |
160 | &mut self, |
161 | _requester: , |
162 | _user: &User, |
163 | |
164 | todo! |
165 | |
166 | |
167 | |
168 | |
169 | |
170 | async |
171 | &mut self, |
172 | _request: RegisterAccountRequest, |
173 | |
174 | todo! |
175 | |
176 | |
177 | async |
178 | &mut self, |
179 | _source: &Instance, |
180 | _request: AuthenticationTokenRequest, |
181 | |
182 | todo! |
183 | |
184 | |
185 | |
186 | ; |
187 | |
188 | |
189 | |
190 | async |
191 | &mut self, |
192 | _user: &User, |
193 | _request: &RepositoryCreateRequest, |
194 | |
195 | todo! |
196 | |
197 | async |
198 | &mut self, |
199 | _requester: , |
200 | _repository: &Repository, |
201 | _request: &RepositoryFileInspectRequest, |
202 | |
203 | todo! |
204 | |
205 | async |
206 | &mut self, |
207 | _requester: , |
208 | _repository: &Repository, |
209 | _request: &RepositoryFileFromIdRequest, |
210 | |
211 | todo! |
212 | |
213 | async |
214 | &mut self, |
215 | _requester: , |
216 | _repository: &Repository, |
217 | _request: &RepositoryDiffRequest, |
218 | |
219 | todo! |
220 | |
221 | async |
222 | &mut self, |
223 | _requester: , |
224 | _repository: &Repository, |
225 | _request: &RepositoryCommitBeforeRequest, |
226 | |
227 | todo! |
228 | |
229 | async |
230 | &mut self, |
231 | _repository: &Repository, |
232 | _name: &str, |
233 | |
234 | Ok |
235 | & to_vec .unwrap, |
236 | |
237 | .unwrap |
238 | |
239 | async |
240 | &mut self, |
241 | _repository: &Repository, |
242 | _name: &str, |
243 | |
244 | Ok |
245 | & to_vec .unwrap, |
246 | |
247 | .unwrap |
248 | |
249 | async |
250 | &mut self, |
251 | _repository: &Repository, |
252 | _name: &str, |
253 | _setting: &Value, |
254 | |
255 | Ok |
256 | |
257 | |
258 | async |
259 | // Ok(true) |
260 | Ok |
261 | == & from_str |
262 | "test_user:test.giterated.dev/[email protected]", |
263 | |
264 | .unwrap |
265 | |
266 | |
267 | |
268 | |
269 | DatabaseBackend |
270 | our_instance: from_str .unwrap, |
271 | user_backend: new as _, |
272 | repository_backend: new as _, |
273 | |
274 | .into_backend |
275 | |
276 | |
277 | |
278 | async |
279 | let backend = test_backend; |
280 | |
281 | let mut user = backend |
282 | . |
283 | .await |
284 | .expect; |
285 | |
286 | user. |
287 | .await |
288 | .expect; |
289 | |
290 | |
291 | |
292 | async |
293 | let backend = test_backend; |
294 | |
295 | let mut user = backend |
296 | . |
297 | .await |
298 | .expect; |
299 | |
300 | user. |
301 | .await |
302 | .expect; |
303 | |
304 | |
305 | |
306 | async |
307 | let backend = test_backend; |
308 | |
309 | let mut user = backend |
310 | . |
311 | .await |
312 | .expect; |
313 | |
314 | user. |
315 | .await |
316 | .expect; |
317 | |
318 | |
319 | |
320 | async |
321 | let backend = test_backend; |
322 | |
323 | let mut repository = backend |
324 | . |
325 | .await |
326 | .expect; |
327 | |
328 | repository |
329 | . |
330 | .await |
331 | .expect; |
332 | |
333 | |
334 | |
335 | async |
336 | let backend = test_backend; |
337 | |
338 | let mut repository = backend |
339 | . |
340 | .await |
341 | .expect; |
342 | |
343 | repository |
344 | . |
345 | .await |
346 | .expect; |
347 | |
348 | |
349 | |
350 | async |
351 | let backend = test_backend; |
352 | |
353 | let mut repository = backend |
354 | . |
355 | .await |
356 | .expect; |
357 | |
358 | repository |
359 | . |
360 | .await |
361 | .expect; |
362 | |
363 | |
364 |