mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Move Svelto/RC op ID copying logic into openjam servers
This commit is contained in:
@@ -7,3 +7,5 @@ pub use state::UserState;
|
||||
pub mod persist;
|
||||
pub use persist::user::{UserImpl, UserProvider, UserAuthenticator};
|
||||
pub use persist::config::{ConfigImpl, ConfigProvider};
|
||||
|
||||
pub mod polariton;
|
||||
|
||||
2
rc_core/src/polariton/mod.rs
Normal file
2
rc_core/src/polariton/mod.rs
Normal file
@@ -0,0 +1,2 @@
|
||||
mod svelto_uuid_copy;
|
||||
pub use svelto_uuid_copy::OpIdCopy;
|
||||
15
rc_core/src/polariton/svelto_uuid_copy.rs
Normal file
15
rc_core/src/polariton/svelto_uuid_copy.rs
Normal 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user