2021-06-30 23:11:27 +08:00
|
|
|
pub mod module;
|
|
|
|
pub use module::*;
|
|
|
|
|
2021-06-28 23:58:43 +08:00
|
|
|
use flowy_sys::prelude::*;
|
2021-06-30 23:11:27 +08:00
|
|
|
use module::build_modules;
|
2021-06-28 23:58:43 +08:00
|
|
|
pub struct FlowySDK {}
|
|
|
|
|
|
|
|
impl FlowySDK {
|
2021-07-02 20:47:52 +08:00
|
|
|
pub fn init_log() { flowy_log::init_log("flowy", "Debug").unwrap(); }
|
2021-06-28 23:58:43 +08:00
|
|
|
|
2021-07-02 20:47:52 +08:00
|
|
|
pub fn init(path: &str) {
|
|
|
|
log::info!("🔥 System start running");
|
|
|
|
log::debug!("🔥 Root path: {}", path);
|
|
|
|
EventDispatch::construct(|| build_modules());
|
2021-06-30 23:11:27 +08:00
|
|
|
}
|
2021-06-28 23:58:43 +08:00
|
|
|
}
|
|
|
|
|
2021-07-02 20:47:52 +08:00
|
|
|
pub async fn async_send(data: DispatchRequest<i64>) -> Result<EventResponse, SystemError> {
|
|
|
|
EventDispatch::async_send(data).await
|
2021-06-28 23:58:43 +08:00
|
|
|
}
|
|
|
|
|
2021-07-02 20:47:52 +08:00
|
|
|
pub fn sync_send(data: DispatchRequest<i64>) -> Result<EventResponse, SystemError> {
|
|
|
|
EventDispatch::sync_send(data)
|
2021-06-28 23:58:43 +08:00
|
|
|
}
|