Giterated stack changeover, refactor still incomplete
parent: tbd commit: 8d40dfe
1 | use Error; |
2 | |
3 | use ; |
4 | use |
5 | , |
6 | , | ObjectBackend
7 | |
8 | Commit, DefaultBranch, Description, LatestCommit, Repository, |
9 | RepositoryCommitBeforeRequest, RepositoryDiff, RepositoryDiffRequest, RepositoryFile, |
10 | RepositoryFileFromIdRequest, RepositoryFileInspectRequest, RepositoryInfoRequest, |
11 | RepositorySummary, RepositoryView, Visibility, |
12 | , |
13 | , |
14 | , |
15 | , |
16 | ; |
17 | |
18 | use DatabaseBackend; |
19 | |
20 | |
21 | object: &User, |
22 | _operation: UserRepositoriesRequest, |
23 | state: DatabaseBackend, |
24 | |
25 | let object = object.clone; |
26 | |
27 | async move |
28 | let mut user_backend = state.user_backend.lock .await; |
29 | let repositories = user_backend |
30 | .repositories_for_user |
31 | .await |
32 | .map_err?; |
33 | |
34 | Ok |
35 | |
36 | .boxed |
37 | |
38 | |
39 | |
40 | object: &User, |
41 | operation: , |
42 | state: DatabaseBackend, |
43 | |
44 | let object = object.clone; |
45 | |
46 | async move |
47 | let mut user_backend = state.user_backend.lock .await; |
48 | let value = user_backend |
49 | .get_value |
50 | .await |
51 | .map_err?; |
52 | |
53 | Ok |
54 | |
55 | .boxed |
56 | |
57 | |
58 | |
59 | object: &User, |
60 | operation: , |
61 | state: DatabaseBackend, |
62 | |
63 | let object = object.clone; |
64 | |
65 | async move |
66 | let mut user_backend = state.user_backend.lock .await; |
67 | let value = user_backend |
68 | .get_setting |
69 | .await |
70 | .map_err?; |
71 | |
72 | Ok |
73 | |
74 | .boxed |
75 | |
76 | |
77 | |
78 | object: &User, |
79 | operation: , |
80 | state: DatabaseBackend, |
81 | |
82 | let object = object.clone; |
83 | |
84 | async move |
85 | let mut user_backend = state.user_backend.lock .await; |
86 | let value = user_backend |
87 | .write_setting |
88 | .await |
89 | .map_err?; |
90 | |
91 | Ok |
92 | |
93 | .boxed |
94 | |
95 | |
96 | |
97 | object: &Repository, |
98 | operation: RepositoryInfoRequest, |
99 | state: DatabaseBackend, |
100 | |
101 | let object = object.clone; |
102 | let backend = state.into_backend; |
103 | |
104 | async move |
105 | let mut object = backend |
106 | . |
107 | .await |
108 | .unwrap; |
109 | |
110 | let mut repository_backend = state.repository_backend.lock .await; |
111 | let tree = repository_backend |
112 | .repository_file_inspect |
113 | None, |
114 | object.object, |
115 | &RepositoryFileInspectRequest |
116 | extra_metadata: operation.extra_metadata, |
117 | path: operation.path, |
118 | rev: operation.rev.clone, |
119 | , |
120 | |
121 | .await |
122 | .map_err?; |
123 | drop; |
124 | |
125 | let info = RepositoryView |
126 | name: object.object .name.clone, |
127 | owner: object.object .owner.clone, |
128 | description: object. .await.ok, |
129 | visibility: object |
130 | . |
131 | .await |
132 | .map_err?, |
133 | default_branch: object |
134 | . |
135 | .await |
136 | .map_err?, |
137 | // TODO: Can't be a simple get function, this needs to be returned alongside the tree as this differs depending on the rev and path. |
138 | latest_commit: object. .await.ok, |
139 | tree_rev: operation.rev, |
140 | tree, |
141 | ; |
142 | |
143 | Ok |
144 | |
145 | .boxed |
146 | |
147 | |
148 | |
149 | object: &Repository, |
150 | operation: RepositoryFileFromIdRequest, |
151 | state: DatabaseBackend, |
152 | |
153 | let object = object.clone; |
154 | let backend = state.into_backend; |
155 | |
156 | async move |
157 | let object = backend |
158 | . |
159 | .await |
160 | .unwrap; |
161 | |
162 | let mut repository_backend = state.repository_backend.lock .await; |
163 | let file = repository_backend |
164 | .repository_file_from_id |
165 | None, |
166 | object.object, |
167 | &RepositoryFileFromIdRequest, |
168 | |
169 | .await |
170 | .map_err?; |
171 | drop; |
172 | |
173 | Ok |
174 | |
175 | .boxed |
176 | |
177 | |
178 | |
179 | object: &Repository, |
180 | operation: RepositoryDiffRequest, |
181 | state: DatabaseBackend, |
182 | |
183 | let object = object.clone; |
184 | let backend = state.into_backend; |
185 | |
186 | async move |
187 | let object = backend |
188 | . |
189 | .await |
190 | .unwrap; |
191 | |
192 | let mut repository_backend = state.repository_backend.lock .await; |
193 | let file = repository_backend |
194 | .repository_diff |
195 | .await |
196 | .map_err?; |
197 | drop; |
198 | |
199 | Ok |
200 | |
201 | .boxed |
202 | |
203 | |
204 | |
205 | object: &Repository, |
206 | operation: RepositoryCommitBeforeRequest, |
207 | state: DatabaseBackend, |
208 | |
209 | let object = object.clone; |
210 | let backend = state.into_backend; |
211 | |
212 | async move |
213 | let object = backend |
214 | . |
215 | .await |
216 | .unwrap; |
217 | |
218 | let mut repository_backend = state.repository_backend.lock .await; |
219 | let file = repository_backend |
220 | .repository_commit_before |
221 | .await |
222 | .map_err?; |
223 | drop; |
224 | |
225 | Ok |
226 | |
227 | .boxed |
228 | |
229 | |
230 | |
231 | object: &Repository, |
232 | operation: , |
233 | state: DatabaseBackend, |
234 | |
235 | let object = object.clone; |
236 | |
237 | async move |
238 | let mut repository_backend = state.repository_backend.lock .await; |
239 | let value = repository_backend |
240 | .get_value |
241 | .await |
242 | .map_err |
243 | Internal |
244 | ?; |
245 | |
246 | Ok |
247 | |
248 | .boxed |
249 | |
250 | |
251 | |
252 | object: &Repository, |
253 | operation: , |
254 | state: DatabaseBackend, |
255 | |
256 | let object = object.clone; |
257 | |
258 | async move |
259 | let mut repository_backend = state.repository_backend.lock .await; |
260 | let value = repository_backend |
261 | .get_setting |
262 | .await |
263 | .map_err?; |
264 | |
265 | Ok |
266 | |
267 | .boxed |
268 | |
269 | |
270 | |
271 | object: &Repository, |
272 | operation: , |
273 | state: DatabaseBackend, |
274 | |
275 | let object = object.clone; |
276 | |
277 | async move |
278 | let mut repository_backend = state.repository_backend.lock .await; |
279 | let value = repository_backend |
280 | .write_setting |
281 | .await |
282 | .map_err?; |
283 | |
284 | Ok |
285 | |
286 | .boxed |
287 | |
288 |