Skip to main content

v_module_queue/
backend.rs

1use crate::api::MStorageClient;
2use crate::module::Module;
3
4/// Lightweight module host: waits for main module via mstorage NNG, no storage / FT / xapian.
5pub struct Backend {
6    pub mstorage_api: MStorageClient,
7}
8
9impl Default for Backend {
10    fn default() -> Self {
11        Self::new()
12    }
13}
14
15impl Backend {
16    pub fn new() -> Self {
17        let param_name = "main_module_url";
18        let mstorage_api = if let Some(url) = Module::get_property(param_name) {
19            MStorageClient::new(url)
20        } else {
21            error!("not found param {} in properties file", param_name);
22            MStorageClient::new("".to_owned())
23        };
24
25        Backend { mstorage_api }
26    }
27}