feat: Add setup for Rust environment and implement test workflows
This commit is contained in:
38
apps/nxmesh-agent/src/service/master_handler.rs
Normal file
38
apps/nxmesh-agent/src/service/master_handler.rs
Normal file
@@ -0,0 +1,38 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use nxmesh_proto::ConfigUpdate;
|
||||
use tracing::info;
|
||||
|
||||
use crate::connector::master::MasterConnector;
|
||||
|
||||
#[async_trait::async_trait]
|
||||
pub trait MasterHandler {
|
||||
async fn on_config_update(
|
||||
&self,
|
||||
config_info: ConfigUpdate,
|
||||
) -> Result<(), Box<dyn std::error::Error + Send + Sync>>;
|
||||
}
|
||||
|
||||
pub struct MasterHandlerImpl {
|
||||
settings: Arc<crate::config::settings::Settings>,
|
||||
}
|
||||
|
||||
impl MasterHandlerImpl {
|
||||
pub fn new(settings: impl Into<Arc<crate::config::settings::Settings>>) -> Self {
|
||||
Self {
|
||||
settings: settings.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl MasterHandler for MasterHandlerImpl {
|
||||
async fn on_config_update(
|
||||
&self,
|
||||
config_info: ConfigUpdate,
|
||||
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||
info!("Received config update from master: {:?}", config_info);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user