///
/// `apply_interval`: Commit journal after `apply_interval` seconds.
///
- /// `load_rrd_cb`; The callback function is use to load RRD files,
+ /// `load_rrd_cb`; The callback function is used to load RRD files,
/// and should return a newly generated RRD if the file does not
/// exists (or is unreadable). This may generate RRDs with
/// different configurations (dependent on `rel_path`).
Ok(())
}
+ /// Apply journal. Should be used at server startup.
pub fn apply_journal(&self) -> Result<(), Error> {
let mut state = self.state.write().unwrap(); // block writers
self.apply_journal_locked(&mut state)
/// Extract data from cached RRD
///
/// `start`: Start time. If not sepecified, we simply extract 10 data points.
+ ///
/// `end`: End time. Default is to use the current time.
pub fn extract_cached_data(
&self,
}
#[derive(Serialize, Deserialize)]
+/// Data source specification
pub struct DataSource {
/// Data source type
pub dst: DST,
}
#[derive(Serialize, Deserialize)]
+/// Round Robin Archive
pub struct RRA {
+ /// Number of seconds spaned by a single data entry.
pub resolution: u64,
+ /// Consolitation function.
pub cf: CF,
- /// Count values computed inside this update interval
+ /// Count values computed inside this update interval.
pub last_count: u64,
- /// The actual data
+ /// The actual data entries.
pub data: Vec<f64>,
}
}
#[derive(Serialize, Deserialize)]
+/// Round Robin Database
pub struct RRD {
+ /// The data source definition
pub source: DataSource,
+ /// List of round robin archives
pub rra_list: Vec<RRA>,
}