diff --git a/Cargo.toml b/Cargo.toml index 275e3c959..ac8540bd9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -74,7 +74,7 @@ proxmox-openid = "0.10.0" proxmox-rest-server = { version = "0.7", features = [ "templates" ] } # some use "cli", some use "cli" and "server", pbs-config uses nothing proxmox-router = { version = "2.0.0", default-features = false } -proxmox-rrd = { version = "0.2" } +proxmox-rrd = { version = "0.2", features = [ "api-types" ]} # everything but pbs-config and pbs-client use "api-macro" proxmox-schema = "3" proxmox-section-config = "2" diff --git a/pbs-api-types/src/lib.rs b/pbs-api-types/src/lib.rs index 40bcd8f12..635292a54 100644 --- a/pbs-api-types/src/lib.rs +++ b/pbs-api-types/src/lib.rs @@ -317,36 +317,6 @@ pub const NODE_TASKS_LIST_TASKS_RETURN_TYPE: ReturnType = ReturnType { schema: &ArraySchema::new("A list of tasks.", &TaskListItem::API_SCHEMA).schema(), }; -#[api()] -#[derive(Copy, Clone, Serialize, Deserialize)] -#[serde(rename_all = "UPPERCASE")] -/// RRD consolidation mode -pub enum RRDMode { - /// Maximum - Max, - /// Average - Average, -} - -#[api()] -#[derive(Copy, Clone, Serialize, Deserialize)] -#[serde(rename_all = "lowercase")] -/// RRD time frame -pub enum RRDTimeFrame { - /// Hour - Hour, - /// Day - Day, - /// Week - Week, - /// Month - Month, - /// Year - Year, - /// Decade (10 years) - Decade, -} - #[api] #[derive(Deserialize, Serialize, Copy, Clone, PartialEq, Eq)] #[serde(rename_all = "lowercase")] diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs index 09518c64e..976617d9f 100644 --- a/src/api2/admin/datastore.rs +++ b/src/api2/admin/datastore.rs @@ -22,6 +22,7 @@ use proxmox_router::{ http_err, list_subdirs_api_method, ApiHandler, ApiMethod, ApiResponseFuture, Permission, Router, RpcEnvironment, RpcEnvironmentType, SubdirMap, }; +use proxmox_rrd::api_types::{RRDMode, RRDTimeFrame}; use proxmox_schema::*; use proxmox_sortable_macro::sortable; use proxmox_sys::fs::{ @@ -36,11 +37,11 @@ use pbs_api_types::{ print_ns_and_snapshot, print_store_and_ns, Authid, BackupContent, BackupNamespace, BackupType, Counts, CryptMode, DataStoreConfig, DataStoreListItem, DataStoreStatus, GarbageCollectionJobStatus, GroupListItem, JobScheduleStatus, KeepOptions, Operation, - PruneJobOptions, RRDMode, RRDTimeFrame, SnapshotListItem, SnapshotVerifyState, - BACKUP_ARCHIVE_NAME_SCHEMA, BACKUP_ID_SCHEMA, BACKUP_NAMESPACE_SCHEMA, BACKUP_TIME_SCHEMA, - BACKUP_TYPE_SCHEMA, DATASTORE_SCHEMA, IGNORE_VERIFIED_BACKUPS_SCHEMA, MAX_NAMESPACE_DEPTH, - NS_MAX_DEPTH_SCHEMA, PRIV_DATASTORE_AUDIT, PRIV_DATASTORE_BACKUP, PRIV_DATASTORE_MODIFY, - PRIV_DATASTORE_PRUNE, PRIV_DATASTORE_READ, PRIV_DATASTORE_VERIFY, UPID, UPID_SCHEMA, + PruneJobOptions, SnapshotListItem, SnapshotVerifyState, BACKUP_ARCHIVE_NAME_SCHEMA, + BACKUP_ID_SCHEMA, BACKUP_NAMESPACE_SCHEMA, BACKUP_TIME_SCHEMA, BACKUP_TYPE_SCHEMA, + DATASTORE_SCHEMA, IGNORE_VERIFIED_BACKUPS_SCHEMA, MAX_NAMESPACE_DEPTH, NS_MAX_DEPTH_SCHEMA, + PRIV_DATASTORE_AUDIT, PRIV_DATASTORE_BACKUP, PRIV_DATASTORE_MODIFY, PRIV_DATASTORE_PRUNE, + PRIV_DATASTORE_READ, PRIV_DATASTORE_VERIFY, UPID, UPID_SCHEMA, VERIFICATION_OUTDATED_AFTER_SCHEMA, }; use pbs_client::pxar::{create_tar, create_zip}; diff --git a/src/api2/node/rrd.rs b/src/api2/node/rrd.rs index 89e902b97..dc7826d47 100644 --- a/src/api2/node/rrd.rs +++ b/src/api2/node/rrd.rs @@ -3,9 +3,10 @@ use serde_json::{json, Value}; use std::collections::BTreeMap; use proxmox_router::{Permission, Router}; +use proxmox_rrd::api_types::{RRDMode, RRDTimeFrame}; use proxmox_schema::api; -use pbs_api_types::{RRDMode, RRDTimeFrame, NODE_SCHEMA, PRIV_SYS_AUDIT}; +use pbs_api_types::{NODE_SCHEMA, PRIV_SYS_AUDIT}; use crate::rrd_cache::extract_rrd_data; diff --git a/src/api2/status.rs b/src/api2/status.rs index 78bc06b55..f1ae0ef5d 100644 --- a/src/api2/status.rs +++ b/src/api2/status.rs @@ -5,11 +5,11 @@ use serde_json::Value; use proxmox_router::list_subdirs_api_method; use proxmox_router::{ApiMethod, Permission, Router, RpcEnvironment, SubdirMap}; +use proxmox_rrd::api_types::{RRDMode, RRDTimeFrame}; use proxmox_schema::api; use pbs_api_types::{ - Authid, DataStoreStatusListItem, Operation, RRDMode, RRDTimeFrame, PRIV_DATASTORE_AUDIT, - PRIV_DATASTORE_BACKUP, + Authid, DataStoreStatusListItem, Operation, PRIV_DATASTORE_AUDIT, PRIV_DATASTORE_BACKUP, }; use pbs_config::CachedUserInfo; diff --git a/src/rrd_cache.rs b/src/rrd_cache.rs index 7ca280de0..8210ef6d5 100644 --- a/src/rrd_cache.rs +++ b/src/rrd_cache.rs @@ -9,12 +9,12 @@ use std::path::Path; use anyhow::{format_err, Error}; use once_cell::sync::OnceCell; -use proxmox_rrd::rrd::{AggregationFn, DataSourceType, Database, Archive}; +use proxmox_rrd::rrd::{AggregationFn, Archive, DataSourceType, Database}; use proxmox_rrd::Cache; use proxmox_sys::fs::CreateOptions; -use pbs_api_types::{RRDMode, RRDTimeFrame}; use pbs_buildcfg::PROXMOX_BACKUP_STATE_DIR_M; +use proxmox_rrd::api_types::{RRDMode, RRDTimeFrame}; const RRD_CACHE_BASEDIR: &str = concat!(PROXMOX_BACKUP_STATE_DIR_M!(), "/rrdb");