proxmox-rrd: remove dependency to proxmox-rrd-api-types

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Dietmar Maurer
2021-10-13 10:24:42 +02:00
committed by Thomas Lamprecht
parent 1198f8d4e6
commit eb37d4ece2
6 changed files with 54 additions and 41 deletions

View File

@ -9,26 +9,23 @@ use pbs_api_types::{
NODE_SCHEMA, RRDMode, RRDTimeFrameResolution, PRIV_SYS_AUDIT,
};
use crate::get_rrd_cache;
use crate::extract_rrd_data;
pub fn create_value_from_rrd(
basedir: &str,
list: &[&str],
timeframe: RRDTimeFrameResolution,
cf: RRDMode,
mode: RRDMode,
) -> Result<Value, Error> {
let mut result: Vec<Value> = Vec::new();
let now = proxmox_time::epoch_f64();
let rrd_cache = get_rrd_cache()?;
let mut timemap = BTreeMap::new();
let mut last_resolution = None;
for name in list {
let (start, reso, data) = match rrd_cache.extract_cached_data(basedir, name, now, timeframe, cf)? {
let (start, reso, data) = match extract_rrd_data(basedir, name, timeframe, mode)? {
Some(result) => result,
None => continue,
};