diff --git a/examples/basic_example.rs b/examples/basic_example.rs index 3e7601631d59b6c9c91a16ac607755bf0feab703..33569630f299ab3c7cd0d91c2c0b5b8337da23eb 100644 --- a/examples/basic_example.rs +++ b/examples/basic_example.rs @@ -2,7 +2,7 @@ use env_logger::{Builder, Target}; use fleet_apiserver::utils::test::TestServerStartParams; use fleet_apiserver::cores::handlers::datamgr::{datamgr_api, DATA_PLUGIN_MANAGER}; use std::ffi::CString; - +use fleet_apiserver::cores::init_data_plugin_manager; const TCP_ADDRESS: &str = "0.0.0.0:38080"; const UDP_ADDRESS: &str = "0.0.0.0:38081"; @@ -28,18 +28,18 @@ async fn main() { std::process::exit(0) } -fn init_data_plugin_manager() { - unsafe { - if DATA_PLUGIN_MANAGER.is_null() { - DATA_PLUGIN_MANAGER = datamgr_api::NewPluginManager(); - let plugin_to_load_key = CString::new("core.pluginsToLoad").unwrap(); - let plugin_to_load_value = CString::new("Messaging Storage Portal").unwrap(); - datamgr_api::SetParameter( - DATA_PLUGIN_MANAGER, - plugin_to_load_key.as_ptr(), - plugin_to_load_value.as_ptr() - ); - datamgr_api::LoadPlugins(DATA_PLUGIN_MANAGER); - } - } -} \ No newline at end of file +// fn init_data_plugin_manager() { +// unsafe { +// if DATA_PLUGIN_MANAGER.is_null() { +// DATA_PLUGIN_MANAGER = datamgr_api::NewPluginManager(); +// let plugin_to_load_key = CString::new("core.pluginsToLoad").unwrap(); +// let plugin_to_load_value = CString::new("Messaging Storage Portal").unwrap(); +// datamgr_api::SetParameter( +// DATA_PLUGIN_MANAGER, +// plugin_to_load_key.as_ptr(), +// plugin_to_load_value.as_ptr() +// ); +// datamgr_api::LoadPlugins(DATA_PLUGIN_MANAGER); +// } +// } +// } \ No newline at end of file diff --git a/src/cores/mod.rs b/src/cores/mod.rs index 88b9cf772c9914639f0fee7c89bbf5b0a3775ac2..966254012cddb13d8341b95e8deb2e5a9f019af8 100644 --- a/src/cores/mod.rs +++ b/src/cores/mod.rs @@ -1,6 +1,7 @@ +use std::ffi::CString; use bon::Builder; use std::iter::zip; - +use crate::cores::handlers::datamgr::{datamgr_api, DATA_PLUGIN_MANAGER}; pub mod daemons; #[cfg(feature = "servers")] @@ -106,3 +107,21 @@ pub async fn start_server(params: ServerStartParams) -> anyhow::Result<()> { } Ok(()) } + + + +pub fn init_data_plugin_manager() { + unsafe { + if DATA_PLUGIN_MANAGER.is_null() { + DATA_PLUGIN_MANAGER = datamgr_api::NewPluginManager(); + let plugin_to_load_key = CString::new("core.pluginsToLoad").unwrap(); + let plugin_to_load_value = CString::new("Messaging Storage Portal").unwrap(); + datamgr_api::SetParameter( + DATA_PLUGIN_MANAGER, + plugin_to_load_key.as_ptr(), + plugin_to_load_value.as_ptr() + ); + datamgr_api::LoadPlugins(DATA_PLUGIN_MANAGER); + } + } +} \ No newline at end of file