use zbus::{proxy, Result};
mod types;
pub use types::{Measure, Measures};
pub use types::{PreparedPoint, Tid};
pub use types::{Transaction, Transactions};
#[proxy(
interface = "se.modio.logger.fsipc",
default_service = "se.modio.logger",
default_path = "/se/modio/logger"
)]
pub trait fsipc {
fn get_boxid(&self) -> Result<String>;
fn retrieve(&self, key: &str) -> Result<Measure>;
fn retrieve_all(&self) -> Result<Measures>;
fn store(&self, key: &str, value: &str) -> Result<()>;
fn store_with_time(&self, key: &str, value: &str, when: u64) -> Result<()>;
#[zbus(signal)]
fn store_signal(&self, key: &str, value: &str, when: u64) -> zbus::Result<()>;
#[zbus(signal)]
fn transaction_added(&self, key: &str) -> zbus::Result<()>;
fn transaction_add(&self, key: &str, expected: &str, target: &str, token: &str) -> Result<()>;
fn transaction_fail(&self, t_id: Tid) -> Result<()>;
fn transaction_get(&self, keyspace: &str) -> Result<Transactions>;
fn transaction_pass(&self, t_id: Tid) -> Result<()>;
fn valid_key(&self, key: &str) -> Result<bool>;
fn ping(&self) -> Result<String>;
fn done(&self) -> Result<()>;
fn prepare_datapoints(&self, maximum: u32) -> Result<Vec<PreparedPoint>>;
fn prepare_modio_datapoints(&self, maximum: u32) -> Result<Vec<PreparedPoint>>;
fn remove_prepared(&self, items: Vec<i64>) -> Result<()>;
}
#[cfg(test)]
mod tests {
use super::fsipcProxy;
#[async_std::test]
async fn it_works() {
let conn = zbus::Connection::session().await.unwrap();
let proxy = fsipcProxy::builder(&conn)
.destination("se.modio.logger.TestFsIPC")
.unwrap()
.path("/se/modio/logger")
.unwrap()
.build()
.await;
assert!(proxy.is_ok());
}
}