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 | 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 | . |
88 | . |
89 | .; |
90 | |
91 | new |
92 | |
93 | |
94 | |
95 | |
96 | |
97 | f.debug_struct .finish |
98 | |
99 | |
100 | |
101 | // TODO: These should be on the stack |
102 | // These tests verify that the essential handling of the database backend is |
103 | // functional and correct. |
104 | |
105 | |
106 | use ; |
107 | |
108 | use Error; |
109 | |
110 | use UserAuthenticationToken; |
111 | |
112 | use |
113 | AuthenticationTokenRequest, Instance, RegisterAccountRequest, RepositoryCreateRequest, |
114 | ; |
115 | |
116 | use ObjectBackend; |
117 | |
118 | use |
119 | Commit, Description, Repository, RepositoryCommitBeforeRequest, RepositoryDiff, |
120 | RepositoryDiffRequest, RepositoryFile, RepositoryFileFromIdRequest, |
121 | RepositoryFileInspectRequest, RepositorySummary, RepositoryTreeEntry, RepositoryDiffPatchRequest, |
122 | ; |
123 | use AnySetting; |
124 | use ; |
125 | use ; |
126 | use GiteratedBackend; |
127 | use StackOperationState; |
128 | use Value; |
129 | use Mutex; |
130 | |
131 | use crate; |
132 | |
133 | use DatabaseBackend; |
134 | ; |
135 | |
136 | |
137 | |
138 | async |
139 | assert_eq!; |
140 | |
141 | Ok |
142 | & to_vec .unwrap, |
143 | |
144 | .unwrap |
145 | |
146 | async |
147 | Ok |
148 | & to_vec .unwrap, |
149 | |
150 | .unwrap |
151 | |
152 | async |
153 | &mut self, |
154 | _user: &User, |
155 | _name: &str, |
156 | _setting: &Value, |
157 | |
158 | Ok |
159 | |
160 | async |
161 | Ok |
162 | |
163 | async |
164 | &mut self, |
165 | _requester: , |
166 | _user: &User, |
167 | |
168 | todo! |
169 | |
170 | |
171 | |
172 | |
173 | |
174 | async |
175 | &mut self, |
176 | _request: RegisterAccountRequest, |
177 | |
178 | todo! |
179 | |
180 | |
181 | async |
182 | &mut self, |
183 | _source: &Instance, |
184 | _request: AuthenticationTokenRequest, |
185 | |
186 | todo! |
187 | |
188 | |
189 | |
190 | ; |
191 | |
192 | |
193 | |
194 | async |
195 | &mut self, |
196 | _user: &User, |
197 | _request: &RepositoryCreateRequest, |
198 | |
199 | todo! |
200 | |
201 | async |
202 | &mut self, |
203 | _requester: , |
204 | _repository: &Repository, |
205 | _request: &RepositoryFileInspectRequest, |
206 | |
207 | todo! |
208 | |
209 | async |
210 | &mut self, |
211 | _requester: , |
212 | _repository: &Repository, |
213 | _request: &RepositoryFileFromIdRequest, |
214 | |
215 | todo! |
216 | |
217 | async |
218 | &mut self, |
219 | _requester: , |
220 | _repository: &Repository, |
221 | _request: &RepositoryDiffRequest, |
222 | |
223 | todo! |
224 | |
225 | async |
226 | &mut self, |
227 | _requester: , |
228 | _repository: &Repository, |
229 | _request: &RepositoryDiffPatchRequest, |
230 | |
231 | todo! |
232 | |
233 | async |
234 | &mut self, |
235 | _requester: , |
236 | _repository: &Repository, |
237 | _request: &RepositoryCommitBeforeRequest, |
238 | |
239 | todo! |
240 | |
241 | async |
242 | &mut self, |
243 | _repository: &Repository, |
244 | _name: &str, |
245 | |
246 | Ok |
247 | & to_vec .unwrap, |
248 | |
249 | .unwrap |
250 | |
251 | async |
252 | &mut self, |
253 | _repository: &Repository, |
254 | _name: &str, |
255 | |
256 | Ok |
257 | & to_vec .unwrap, |
258 | |
259 | .unwrap |
260 | |
261 | async |
262 | &mut self, |
263 | _repository: &Repository, |
264 | _name: &str, |
265 | _setting: &Value, |
266 | |
267 | Ok |
268 | |
269 | |
270 | async |
271 | // Ok(true) |
272 | Ok |
273 | == & from_str |
274 | "test_user:test.giterated.dev/[email protected]", |
275 | |
276 | .unwrap |
277 | |
278 | |
279 | |
280 | |
281 | DatabaseBackend |
282 | our_instance: from_str .unwrap, |
283 | user_backend: new as _, |
284 | repository_backend: new as _, |
285 | |
286 | .into_backend |
287 | |
288 | |
289 | |
290 | todo! |
291 | |
292 | |
293 | |
294 | async |
295 | let backend = test_backend; |
296 | let operation_state = operation_state; |
297 | |
298 | let mut user = backend |
299 | . |
300 | .await |
301 | .expect; |
302 | |
303 | user. |
304 | .await |
305 | .expect; |
306 | |
307 | |
308 | |
309 | async |
310 | let backend = test_backend; |
311 | let operation_state = operation_state; |
312 | |
313 | let mut user = backend |
314 | . |
315 | .await |
316 | .expect; |
317 | |
318 | user. |
319 | .await |
320 | .expect; |
321 | |
322 | |
323 | |
324 | async |
325 | let backend = test_backend; |
326 | let operation_state = operation_state; |
327 | |
328 | let mut user = backend |
329 | . |
330 | .await |
331 | .expect; |
332 | |
333 | user. |
334 | .await |
335 | .expect; |
336 | |
337 | |
338 | |
339 | async |
340 | let backend = test_backend; |
341 | let operation_state = operation_state; |
342 | |
343 | let mut repository = backend |
344 | . |
345 | "test_user:test.giterated.dev/[email protected]", |
346 | &operation_state, |
347 | |
348 | .await |
349 | .expect; |
350 | |
351 | repository |
352 | . |
353 | .await |
354 | .expect; |
355 | |
356 | |
357 | |
358 | async |
359 | let backend = test_backend; |
360 | let operation_state = operation_state; |
361 | |
362 | let mut repository = backend |
363 | . |
364 | "test_user:test.giterated.dev/[email protected]", |
365 | &operation_state, |
366 | |
367 | .await |
368 | .expect; |
369 | |
370 | repository |
371 | . |
372 | .await |
373 | .expect; |
374 | |
375 | |
376 | |
377 | async |
378 | let backend = test_backend; |
379 | let operation_state = operation_state; |
380 | |
381 | let mut repository = backend |
382 | . |
383 | "test_user:test.giterated.dev/[email protected]", |
384 | &operation_state, |
385 | |
386 | .await |
387 | .expect; |
388 | |
389 | repository |
390 | . |
391 | .await |
392 | .expect; |
393 | |
394 | |
395 |