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

ambee/giterated

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

`[feature/plugins]` Some plugin work?

Amber - ⁨1⁩ year ago

parent: tbd commit: ⁨10a447b

⁨giterated-plugin/src/new_stack/handle.rs⁩ - ⁨1498⁩ bytes
Raw
1 use std::marker::PhantomData;
2
3 use giterated_models::{
4 error::OperationError,
5 object::{GiteratedObject, Object, ObjectRequestError},
6 object_backend::ObjectBackend,
7 operation::GiteratedOperation,
8 };
9 use std::fmt::Debug;
10
11 use crate::vtable::RuntimeVTable;
12
13 use super::OperationState;
14
15 #[derive(Clone)]
16 pub struct RuntimeHandle {
17 runtime_vtable: RuntimeVTable,
18 }
19
20 impl RuntimeHandle {
21 pub async fn handle_serialized(
22 &self,
23 object: &str,
24 operation_name: &str,
25 payload: &[u8],
26 ) -> Result<Vec<u8>, OperationError<Vec<u8>>> {
27 todo!()
28 }
29 }
30
31 impl RuntimeHandle {
32 pub(crate) unsafe fn from_vtable(runtime_vtable: RuntimeVTable) -> Self {
33 Self { runtime_vtable }
34 }
35 }
36
37 #[async_trait::async_trait(?Send)]
38 impl ObjectBackend<OperationState> for RuntimeHandle {
39 async fn object_operation<O, D>(
40 &self,
41 object: O,
42 operation: &str,
43 payload: D,
44 operation_state: &OperationState,
45 ) -> Result<D::Success, OperationError<D::Failure>>
46 where
47 O: GiteratedObject + Debug + 'static,
48 D: GiteratedOperation<O> + Debug + 'static,
49 D::Success: Clone,
50 D::Failure: Clone,
51 {
52 todo!()
53 }
54
55 async fn get_object<O: GiteratedObject + Debug + 'static>(
56 &self,
57 object_str: &str,
58 operation_state: &OperationState,
59 ) -> Result<Object<OperationState, O, Self>, OperationError<ObjectRequestError>> {
60 todo!()
61 }
62 }
63