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

ambee/giterated

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

Finish unified stack refactor.

Adds support for operation state, which will be used to pass authentication information around. Added generic backend that uses a channel to communicate with a typed backend.

Amber - ⁨2⁩ years ago

parent: tbd commit: ⁨d15581c

⁨giterated-models/src/object_backend.rs⁩ - ⁨755⁩ bytes
Raw
1 use crate::{
2 error::OperationError,
3 object::{GiteratedObject, Object, ObjectRequestError},
4 operation::GiteratedOperation,
5 };
6
7 use std::fmt::Debug;
8
9 #[async_trait::async_trait]
10 pub trait ObjectBackend<S: Clone + Send + Sync>: Send + Sync + Sized + Clone {
11 async fn object_operation<O, D>(
12 &self,
13 object: O,
14 operation: &str,
15 payload: D,
16 operation_state: &S,
17 ) -> Result<D::Success, OperationError<D::Failure>>
18 where
19 O: GiteratedObject + Debug,
20 D: GiteratedOperation<O> + Debug;
21
22 async fn get_object<O: GiteratedObject + Debug>(
23 &self,
24 object_str: &str,
25 operation_state: &S,
26 ) -> Result<Object<S, O, Self>, OperationError<ObjectRequestError>>;
27 }
28