use std::fmt::Debug; use std::sync::Arc; use giterated_models::{ error::OperationError, object::{GiteratedObject, Object, ObjectRequestError}, object_backend::ObjectBackend, operation::GiteratedOperation, }; use crate::vtable::{AnyFailure, AnySuccess, OperationVTable}; use super::PluginState; #[derive(Clone)] pub struct RuntimeHandle { inner: Arc, } impl RuntimeHandle { pub async fn handle_serialized( &self, operation_name: &str, object: &str, operation: &[u8], ) -> Result, OperationError>> { todo!() } } #[repr(C)] struct RuntimeHandleInner { state: PluginState, handle_serialized: unsafe extern "C" fn( object_kind: &str, operation_name: &str, object: &str, operation_payload: &[u8], ) -> HandlerResult, } unsafe impl Send for RuntimeHandleInner {} unsafe impl Sync for RuntimeHandleInner {} #[repr(C)] struct HandlerResult { operation_vtable: OperationVTable, result: Result>, } #[async_trait::async_trait(?Send)] impl ObjectBackend for RuntimeHandle { async fn object_operation( &self, object: O, operation: &str, payload: D, operation_state: &S, ) -> Result> where O: GiteratedObject + Debug + 'static, D: GiteratedOperation + Debug + 'static, D::Success: Clone, D::Failure: Clone, { todo!() } async fn get_object( &self, object_str: &str, operation_state: &S, ) -> Result, OperationError> { todo!() } }