Re-expose Operation State in generics.
This is the worst code I have ever written. I hate the way this changes everything. ugh.
parent: tbd commit: 90db3e2
1 | |
2 | |
3 | |
4 | use Any; |
5 | use Arc; |
6 | |
7 | use Context; |
8 | |
9 | use Instance; |
10 | use ; |
11 | use ; |
12 | use MetadataProvider; |
13 | use ; |
14 | use ; |
15 | use Value; |
16 | use PgPool; |
17 | use Debug; |
18 | use ; |
19 | |
20 | use crate; |
21 | use crate; |
22 | |
23 | use |
24 | instance_authentication_request, instance_create_repository_request, |
25 | instance_registration_request, repository_commit_before, repository_commit_by_id, |
26 | repository_diff, repository_diff_patch, repository_file_from_id, repository_file_from_path, |
27 | repository_get_branches, repository_get_statistics, repository_info, |
28 | repository_last_commit_of_file, user_get_repositories, |
29 | ; |
30 | |
31 | /// A backend implementation which attempts to resolve data from the instance's database. |
32 | |
33 | |
34 | |
35 | pub(self) our_instance: Instance, |
36 | pub(self) pool: PgPool, |
37 | pub(self) user_backend: , |
38 | pub(self) repository_backend: , |
39 | pub stack: , |
40 | |
41 | |
42 | |
43 | |
44 | instance: Instance, |
45 | user_backend: , |
46 | repository_backend: , |
47 | pool: PgPool, |
48 | stack: , |
49 | |
50 | Self |
51 | our_instance: instance, |
52 | user_backend, |
53 | repository_backend, |
54 | pool, |
55 | stack, |
56 | |
57 | |
58 | |
59 | |
60 | let mut builder = new; |
61 | |
62 | builder.object_metadata_provider; |
63 | |
64 | builder |
65 | . |
66 | . |
67 | .; |
68 | |
69 | // Register value settings, which are settings that directly correspond to |
70 | // value types. |
71 | builder |
72 | . |
73 | . |
74 | . |
75 | . |
76 | .; |
77 | |
78 | // builder.value(repository_latest_commit); |
79 | |
80 | builder |
81 | .operation |
82 | .operation |
83 | .operation |
84 | .operation |
85 | .operation |
86 | .operation |
87 | .operation |
88 | .operation |
89 | .operation |
90 | .operation |
91 | .operation |
92 | .operation |
93 | .operation |
94 | .operation; |
95 | |
96 | builder |
97 | |
98 | |
99 | |
100 | |
101 | |
102 | f.debug_struct .finish |
103 | |
104 | |
105 | |
106 | |
107 | |
108 | |
109 | object.|| object. || object. |
110 | |
111 | |
112 | async |
113 | &self, |
114 | object: AnyObject, |
115 | _object_meta: &ObjectMeta, |
116 | setting: AnySetting, |
117 | setting_meta: &SettingMeta, |
118 | |
119 | if let Some = object. |
120 | ! | query
121 | repository.to_string, setting_meta.name, to_string? |
122 | .execute .await?; |
123 | |
124 | Ok |
125 | else if let Some = object. |
126 | ! | query
127 | user.username, setting_meta.name, to_string? |
128 | .execute .await?; |
129 | |
130 | Ok |
131 | else |
132 | unreachable! |
133 | |
134 | |
135 | |
136 | async |
137 | &self, |
138 | object: AnyObject, |
139 | _object_meta: &ObjectMeta, |
140 | setting_meta: &SettingMeta, |
141 | |
142 | if let Some = object. |
143 | let row = query_as! |
144 | RepositorySettingRow, |
145 | "SELECT * FROM repository_settings WHERE repository = $1 AND name = $2", |
146 | repository.to_string, |
147 | setting_meta.name |
148 | |
149 | .fetch_one |
150 | .await?; |
151 | |
152 | let setting = |
153 | context?; | from_str .
154 | |
155 | Ok |
156 | else if let Some = object. |
157 | info!; |
158 | let row = query_as! |
159 | UserSettingRow, |
160 | "SELECT * FROM user_settings WHERE username = $1 AND name = $2", |
161 | user.username, |
162 | setting_meta.name |
163 | |
164 | .fetch_one |
165 | .await?; |
166 | |
167 | let setting = |
168 | context?; | from_str .
169 | |
170 | Ok |
171 | else |
172 | unreachable! |
173 | |
174 | |
175 | |
176 |