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