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

ambee/giterated

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

Fixes

Amber - ⁨2⁩ years ago

parent: tbd commit: ⁨b87f0a3

⁨giterated-daemon/src/cache_backend.rs⁩ - ⁨914⁩ bytes
Raw
1 use giterated_models::error::OperationError;
2
3 use giterated_models::object::{GiteratedObject, Object, ObjectRequestError};
4 use giterated_models::object_backend::ObjectBackend;
5 use giterated_models::operation::GiteratedOperation;
6
7 use std::fmt::Debug;
8
9 #[derive(Clone, Debug)]
10 pub struct CacheBackend;
11
12 #[async_trait::async_trait]
13 impl ObjectBackend for CacheBackend {
14 async fn object_operation<O: GiteratedObject + Debug, D: GiteratedOperation<O> + Debug>(
15 &self,
16 _object: O,
17 operation: &str,
18 payload: D,
19 ) -> Result<D::Success, OperationError<D::Failure>> {
20 // We don't handle operations with this backend
21 Err(OperationError::Unhandled)
22 }
23
24 async fn get_object<O: GiteratedObject + Debug>(
25 &self,
26 _object_str: &str,
27 ) -> Result<Object<O, Self>, OperationError<ObjectRequestError>> {
28 Err(OperationError::Unhandled)
29 }
30 }
31