Move Svelto/RC op ID copying logic into openjam servers

This commit is contained in:
NGnius (Graham) committed 2025-04-16 17:25:54 -04:00
1 parent 792a6362e3
commit 69c6c54650
7 files changed
+23

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
mod svelto_uuid_copy;
pub use svelto_uuid_copy::OpIdCopy;
+15
View File
@@ -0,0 +1,15 @@
use polariton_server::operations::OperationModifier;
pub struct OpIdCopy;
impl OpIdCopy {
const SERVICE_MAPPING_KEY: u8 = 0;
}
impl <C: Clone + Send + Sync + 'static> OperationModifier<C> for OpIdCopy {
fn after(&self, req: &mut polariton::operation::OperationRequest<C>, resp: &mut polariton::operation::OperationResponse<C>) {
if let Some(svelto_service_id) = req.params.get(&Self::SERVICE_MAPPING_KEY) {
resp.params.insert(Self::SERVICE_MAPPING_KEY, svelto_service_id.to_owned());
}
}
}