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

ambee/giterated

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

`giterated_cache` initial implementation

# Giterated Stack - Added the ability for dynamic substack handlers to exist for operations relevant to caching. - Added type metadata to the dynamic types. # Giterated Cache - Created - Implemented caching and fetching from cache. Hell fucking yes!!!! It works so good. Are you snooping in the commit logs because you're curious about the history of giterated? Cool that it got so big... tell me I say hi :)

Amber - ⁨2⁩ years ago

parent: tbd commit: ⁨86afeef

⁨giterated-models/src/settings/operations.rs⁩ - ⁨1063⁩ bytes
Raw
1 use std::fmt::Debug;
2
3 use serde::{Deserialize, Serialize};
4 use serde_json::Value;
5 use thiserror::Error;
6
7 use crate::{object::GiteratedObject, operation::GiteratedOperation};
8
9 #[derive(Serialize, Deserialize, Debug, Clone)]
10 pub struct GetSetting {
11 pub setting_name: String,
12 }
13
14 impl<O: GiteratedObject> GiteratedOperation<O> for GetSetting {
15 fn operation_name() -> &'static str {
16 "get_setting"
17 }
18
19 type Success = Value;
20
21 type Failure = GetSettingError;
22 }
23
24 #[derive(Error, Debug, Serialize, Deserialize, Clone)]
25 pub enum GetSettingError {}
26 #[derive(Serialize, Deserialize, Debug, Clone)]
27 pub struct SetSetting {
28 pub setting_name: String,
29 pub value: Value,
30 }
31
32 impl<O: GiteratedObject> GiteratedOperation<O> for SetSetting {
33 fn operation_name() -> &'static str {
34 "set_setting"
35 }
36
37 type Success = ();
38
39 type Failure = SetSettingError;
40 }
41
42 #[derive(Error, Debug, Serialize, Deserialize, Clone)]
43 pub enum SetSettingError {
44 #[error("Invalid setting `{0}` on object `{0}`")]
45 InvalidSetting(String, String),
46 }
47