JavaScript is disabled, refresh for a better experience. ambee/giterated

ambee/giterated

Git repository hosting, collaboration, and discovery for the Fediverse.

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

Amber - ⁨2⁩ years ago

parent: tbd commit: ⁨c377e4d

⁨giterated-daemon/src/database_backend/updates.rs⁩ - ⁨2055⁩ bytes
Raw
1 use futures_util::{future::BoxFuture, FutureExt};
2 use giterated_models::{
3 repository::{Description, Repository},
4 settings::AnySetting,
5 user::User,
6 value::AnyValue,
7 };
8 use giterated_stack::{AuthorizedUser, StackOperationState};
9
10 pub fn user_set_value(
11 _object: User,
12 _value_name: String,
13 _value: AnyValue<User>,
14 _operation_state: &StackOperationState,
15 ) -> BoxFuture<'static, Result<(), ()>> {
16 todo!()
17 }
18
19 pub fn user_set_setting(
20 _object: User,
21 _value_name: String,
22 _value: AnySetting,
23 _operation_state: &StackOperationState,
24 ) -> BoxFuture<'static, Result<(), ()>> {
25 todo!()
26 }
27
28 pub fn repository_set_value(
29 _object: Repository,
30 _value_name: String,
31 _value: AnyValue<Repository>,
32 _operation_state: &StackOperationState,
33 ) -> BoxFuture<'static, Result<(), ()>> {
34 todo!()
35 }
36
37 pub fn repository_set_setting(
38 _object: Repository,
39 _value_name: String,
40 _value: AnySetting,
41 _operation_state: &StackOperationState,
42 ) -> BoxFuture<'static, Result<(), ()>> {
43 todo!()
44 }
45
46 pub fn repository_set_description(
47 _object: Repository,
48 _description: Description,
49 _user: AuthorizedUser,
50 ) -> BoxFuture<'static, Result<(), ()>> {
51 async { Ok(()) }.boxed()
52 }
53
54 // pub fn repository_set_default_branch(
55 // object: Repository,
56 // default_branch: DefaultBranch,
57 // // Ensure user is authorized for this request
58 // _user: AuthorizedUser,
59 // backend: DatabaseBackend,
60 // stack: Arc<GiteratedStack>,
61 // ) -> BoxFuture<'static, Result<(), ()>> {
62 // async move {
63 // stack.write_setting(&object, &default_branch).await.unwrap();
64
65 // let _set_value = ValueUpdate {
66 // object: object.to_string(),
67 // value_name: DefaultBranch::value_name().to_owned(),
68 // value: unsafe { AnyValue::from_raw(serde_json::to_value(default_branch).unwrap()) },
69 // };
70
71 // // Submit value update back to the daemon
72 // // state.value_update(set_value);
73 // Ok(())
74 // }
75 // .boxed()
76 // }
77