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