proxmox-rrd: improve dev docs

This commit is contained in:
Dietmar Maurer 2021-10-14 11:53:54 +02:00
parent 2e3f94e12f
commit a9017805b7
2 changed files with 12 additions and 3 deletions

View File

@ -54,7 +54,7 @@ impl RRDCache {
/// ///
/// `apply_interval`: Commit journal after `apply_interval` seconds. /// `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 /// and should return a newly generated RRD if the file does not
/// exists (or is unreadable). This may generate RRDs with /// exists (or is unreadable). This may generate RRDs with
/// different configurations (dependent on `rel_path`). /// different configurations (dependent on `rel_path`).
@ -171,6 +171,7 @@ impl RRDCache {
Ok(()) Ok(())
} }
/// Apply journal. Should be used at server startup.
pub fn apply_journal(&self) -> Result<(), Error> { pub fn apply_journal(&self) -> Result<(), Error> {
let mut state = self.state.write().unwrap(); // block writers let mut state = self.state.write().unwrap(); // block writers
self.apply_journal_locked(&mut state) self.apply_journal_locked(&mut state)
@ -296,6 +297,7 @@ impl RRDCache {
/// Extract data from cached RRD /// Extract data from cached RRD
/// ///
/// `start`: Start time. If not sepecified, we simply extract 10 data points. /// `start`: Start time. If not sepecified, we simply extract 10 data points.
///
/// `end`: End time. Default is to use the current time. /// `end`: End time. Default is to use the current time.
pub fn extract_cached_data( pub fn extract_cached_data(
&self, &self,

View File

@ -56,6 +56,7 @@ pub enum CF {
} }
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
/// Data source specification
pub struct DataSource { pub struct DataSource {
/// Data source type /// Data source type
pub dst: DST, pub dst: DST,
@ -120,12 +121,15 @@ impl DataSource {
} }
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
/// Round Robin Archive
pub struct RRA { pub struct RRA {
/// Number of seconds spaned by a single data entry.
pub resolution: u64, pub resolution: u64,
/// Consolitation function.
pub cf: CF, pub cf: CF,
/// Count values computed inside this update interval /// Count values computed inside this update interval.
pub last_count: u64, pub last_count: u64,
/// The actual data /// The actual data entries.
pub data: Vec<f64>, pub data: Vec<f64>,
} }
@ -277,8 +281,11 @@ impl RRA {
} }
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
/// Round Robin Database
pub struct RRD { pub struct RRD {
/// The data source definition
pub source: DataSource, pub source: DataSource,
/// List of round robin archives
pub rra_list: Vec<RRA>, pub rra_list: Vec<RRA>,
} }