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

ambee/giterated

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

Progress on refactor

Amber - ⁨2⁩ years ago

parent: tbd commit: ⁨c9f076f

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