//! Interface to fill/query a timeseries database (InfluxDB). use std::time::Instant; use protocol::{Location, Value}; // TODO: Configuration mechanism. /// Interface to InfluxDB. pub struct TimeSeriesDatabase { // TODO } impl TimeSeriesDatabase { /// Initializes the connection to InfluxDB. /// /// The function does not return an error. Instead, the code will automatically retry /// connection in case the connection cannot be established or the server closes the /// connection. pub fn init() -> TimeSeriesDatabase { // TODO TimeSeriesDatabase {} } /// Inserts values into the database. /// /// If there is no current connection to InfluxDB and the connection cannot be reestablished /// before the application is stopped, the values are lost. If multiple calls to this function /// occur while there is no current connection to InfluxDB, the values are queued and all /// values are inserted at a later time. /// /// # Arguments /// /// * `time` - time at which the values were received /// * `location` - location of the device which sent the values /// * `values` - list of values to be inserted into the database pub async fn insert(&mut self, _time: Instant, _location: Location, _values: &[Value]) { // TODO } }