Sin descripción
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

tsdb.rs 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //! Interface to fill/query a timeseries database (InfluxDB).
  2. use std::time::Instant;
  3. use protocol::{Location, Value};
  4. // TODO: Configuration mechanism.
  5. /// Interface to InfluxDB.
  6. pub struct TimeSeriesDatabase {
  7. // TODO
  8. }
  9. impl TimeSeriesDatabase {
  10. /// Initializes the connection to InfluxDB.
  11. ///
  12. /// The function does not return an error. Instead, the code will automatically retry
  13. /// connection in case the connection cannot be established or the server closes the
  14. /// connection.
  15. pub fn init() -> TimeSeriesDatabase {
  16. // TODO
  17. TimeSeriesDatabase {}
  18. }
  19. /// Inserts values into the database.
  20. ///
  21. /// If there is no current connection to InfluxDB and the connection cannot be reestablished
  22. /// before the application is stopped, the values are lost. If multiple calls to this function
  23. /// occur while there is no current connection to InfluxDB, the values are queued and all
  24. /// values are inserted at a later time.
  25. ///
  26. /// # Arguments
  27. ///
  28. /// * `time` - time at which the values were received
  29. /// * `location` - location of the device which sent the values
  30. /// * `values` - list of values to be inserted into the database
  31. pub async fn insert(&mut self, _time: Instant, _location: Location, _values: &[Value]) {
  32. // TODO
  33. }
  34. }