Giterated Stack `ObjectValue` and `Setting` refactor.
This refactor adds value and setting update events, as well as value getters. Additionally, the stack is now the owner of the ability to write settings into storage. This is accomplished with the `MetadataProvider` trait. This sets up the ground work for push federation, cache, and basically everything else. commit 7befc583cb3e0c6719506c550ed66ac76293413c Author: Amber <[email protected]> Date: Fri Sep 29 15:46:48 2023 -0500 Finish value and settings refactor in the stack. commit 3ac09994a0caafd1a0b95d9a781c7f202f20e75b Author: Amber <[email protected]> Date: Fri Sep 29 09:46:32 2023 -0500 Add set_setting handling back in commit 84fd31e3eae85d98fa68a28b333dbb32cde3bdb8 Author: Amber <[email protected]> Date: Wed Sep 27 06:36:31 2023 -0500 Remove some allocations from meta types commit 16c310ce3680c4a14ed35083b6a230aaecd43152 Author: Amber <[email protected]> Date: Wed Sep 27 05:35:03 2023 -0500 Add cargo metadata commit eb2520a20001bac7b21c6c3d34f62db32f0ada80 Author: Amber <[email protected]> Date: Wed Sep 27 05:26:27 2023 -0500 Refactor setting and value management to use the unified stack. Allows for tight management, inspection, and eventing of setting and value management. commit 901fe103da0fce4b40f33b0a8b64404049ae03cf Author: Amber <[email protected]> Date: Wed Sep 27 02:38:33 2023 -0500 Set up ground work for value / settings refactor
parent: tbd commit: c377e4d
1 | use Error; |
2 | use ; |
3 | use |
4 | , | AuthenticationTokenGranter
5 | |
6 | , DatabaseSettings, UserAuth, RepositoryBackend, UserBackend, | GitBackend
7 | , |
8 | , |
9 | , | DatabaseBackend
10 | , | InstanceConnections
11 | ; |
12 | |
13 | use Instance; |
14 | |
15 | use ; |
16 | use ; |
17 | use ; |
18 | use |
19 | , | File
20 | , |
21 | , |
22 | , |
23 | ; |
24 | use ; |
25 | use LocalPoolHandle; |
26 | use Table; |
27 | |
28 | |
29 | extern crate tracing; |
30 | |
31 | |
32 | async |
33 | ; | init
34 | let config: Table = |
35 | let mut file = open .await?; |
36 | let mut text = String new; |
37 | file.read_to_string .await?; |
38 | text.parse? |
39 | ; |
40 | let mut listener = bind .await?; |
41 | let connections: = default; |
42 | let instance_connections: = default; |
43 | let db_conn_options = new |
44 | .host |
45 | .port |
46 | .database |
47 | .username |
48 | .password |
49 | .log_statements; |
50 | let db_pool = connect_with .await?; |
51 | |
52 | debug!; |
53 | ! .run .await?; | migrate
54 | info!; |
55 | |
56 | let stack_cell = new; |
57 | |
58 | let settings = new |
59 | pg_pool: db_pool.clone, |
60 | stack: stack_cell.clone, |
61 | ; |
62 | |
63 | let repository_backend: = |
64 | new |
65 | pg_pool: db_pool.clone, |
66 | repository_folder: String from |
67 | config |
68 | .as_str |
69 | .unwrap, |
70 | , |
71 | instance: from_str |
72 | .unwrap, |
73 | stack: stack_cell.clone, |
74 | ; |
75 | |
76 | let token_granter = new |
77 | config: config.clone, |
78 | instance: from_str .unwrap, |
79 | ; |
80 | |
81 | let user_backend: = new |
82 | db_pool.clone, |
83 | & from_str .unwrap, |
84 | token_granter.clone, |
85 | settings.clone, |
86 | ; |
87 | |
88 | info!; |
89 | |
90 | let database_backend = new |
91 | unwrap, | from_str .
92 | user_backend.clone, |
93 | repository_backend.clone, |
94 | db_pool.clone, |
95 | stack_cell.clone, |
96 | ; |
97 | |
98 | let mut runtime = default; |
99 | |
100 | let database_backend = database_backend.into_substack; |
101 | runtime.merge_builder; |
102 | |
103 | let runtime = new; |
104 | |
105 | stack_cell |
106 | .set |
107 | .expect; |
108 | |
109 | let operation_state = |
110 | StackOperationState |
111 | our_instance: from_str |
112 | .unwrap, |
113 | runtime: runtime.clone, |
114 | instance: None, |
115 | user: None, |
116 | |
117 | ; |
118 | |
119 | let pool = new; |
120 | |
121 | loop |
122 | let stream = accept_stream .await; |
123 | info!; |
124 | |
125 | let = match stream |
126 | Ok => stream, |
127 | Err => |
128 | error!; |
129 | continue; |
130 | |
131 | ; |
132 | |
133 | info!; |
134 | |
135 | let connection = accept_websocket_connection .await; |
136 | |
137 | let connection = match connection |
138 | Ok => connection, |
139 | Err => |
140 | error! |
141 | "Failed to initiate Websocket connection from {}. {:?}", |
142 | address, err |
143 | ; |
144 | continue; |
145 | |
146 | ; |
147 | |
148 | info!; |
149 | let connections_cloned = connections.clone; |
150 | let repository_backend = repository_backend.clone; |
151 | let user_backend = user_backend.clone; |
152 | let token_granter = token_granter.clone; |
153 | let settings = settings.clone; |
154 | let instance_connections = instance_connections.clone; |
155 | let config = config.clone; |
156 | let runtime = runtime.clone; |
157 | let operation_state = operation_state.clone; |
158 | |
159 | pool.spawn_pinned |
160 | connection_wrapper |
161 | connection, |
162 | connections_cloned, |
163 | repository_backend, |
164 | user_backend, |
165 | token_granter, |
166 | settings, |
167 | address, |
168 | unwrap, | from_str .
169 | instance_connections, |
170 | config, |
171 | runtime, |
172 | operation_state, |
173 | |
174 | ; |
175 | |
176 | let connection = RawConnection |
177 | task: spawn, |
178 | ; |
179 | |
180 | connections.lock .await.connections.push; |
181 | |
182 | |
183 | |
184 | async |
185 | let stream = listener.accept .await?; |
186 | |
187 | Ok |
188 | |
189 | |
190 | async |
191 | stream: S, |
192 | |
193 | let connection = accept_async .await?; |
194 | |
195 | Ok |
196 | |
197 |