mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-05-06 09:48:58 +00:00
330659e449
- extend web controller bindings to cover full RPC service set - update rpc_service API wiring and session/controller integration - generate trait-level json_call_method in rpc codegen - route restful proxy-rpc requests via scoped typed clients - add json-call regression tests and required Sync bound fixes~
50 lines
1.2 KiB
Rust
50 lines
1.2 KiB
Rust
use std::sync::Arc;
|
|
|
|
use crate::{
|
|
instance_manager::NetworkInstanceManager, proto::rpc_impl::service_registry::ServiceRegistry,
|
|
rpc_service::api::register_api_rpc_service, web_client::WebClientHooks,
|
|
};
|
|
|
|
pub struct Controller {
|
|
token: String,
|
|
hostname: String,
|
|
manager: Arc<NetworkInstanceManager>,
|
|
hooks: Arc<dyn WebClientHooks>,
|
|
}
|
|
|
|
impl Controller {
|
|
pub fn new(
|
|
token: String,
|
|
hostname: String,
|
|
manager: Arc<NetworkInstanceManager>,
|
|
hooks: Arc<dyn WebClientHooks>,
|
|
) -> Self {
|
|
Controller {
|
|
token,
|
|
hostname,
|
|
manager,
|
|
hooks,
|
|
}
|
|
}
|
|
|
|
pub fn list_network_instance_ids(&self) -> Vec<uuid::Uuid> {
|
|
self.manager.list_network_instance_ids()
|
|
}
|
|
|
|
pub fn token(&self) -> String {
|
|
self.token.clone()
|
|
}
|
|
|
|
pub fn hostname(&self) -> String {
|
|
self.hostname.clone()
|
|
}
|
|
|
|
pub fn register_api_rpc_service(&self, registry: &ServiceRegistry) {
|
|
register_api_rpc_service(&self.manager, registry, Some(self.hooks.clone()));
|
|
}
|
|
|
|
pub(super) fn notify_manager_stopping(&self) {
|
|
self.manager.notify_stop_check();
|
|
}
|
|
}
|