pub mod db;
mod error;
#[cfg(feature = "_informant")]
mod impl_scheduler;
pub mod inform;
pub mod ml;
pub mod net;
pub use error::Error;
#[cfg(feature = "_informant")]
pub use impl_scheduler::Event;
pub struct Representative {
pub storage: db::StorageConnection,
#[allow(unused)]
network: net::Network,
#[cfg(feature = "_informant")]
events_sender: Option<tokio::sync::mpsc::UnboundedSender<Event>>,
}
impl Representative {
pub async fn new(database_file: Option<&std::path::Path>) -> Result<Self, Error> {
tracing::trace!("initializing new Aleym Representative");
Ok(Self {
storage: db::StorageConnection::new(database_file).await?,
network: net::Network::new().await?,
#[cfg(feature = "_informant")]
events_sender: None,
})
}
}