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

ambee/giterated

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

More progress :)

Amber - ⁨1⁩ year ago

parent: tbd commit: ⁨92c3f32

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