rrd_cache: add developer docs

and make RRD_CACHE private (please use get_rrd_cache instead).

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
Dietmar Maurer 2022-02-14 12:03:58 +01:00
parent 7739004815
commit 192ece47fb

View File

@ -1,3 +1,9 @@
//! Round Robin Database cache
//!
//! RRD files are stored under `/var/lib/proxmox-backup/rrdb/`. Only a
//! single process may access and update those files, so we initialize
//! and update RRD data inside `proxmox-backup-proxy`.
use std::path::Path; use std::path::Path;
use anyhow::{format_err, Error}; use anyhow::{format_err, Error};
@ -12,7 +18,7 @@ use pbs_api_types::{RRDMode, RRDTimeFrame};
const RRD_CACHE_BASEDIR: &str = concat!(PROXMOX_BACKUP_STATE_DIR_M!(), "/rrdb"); const RRD_CACHE_BASEDIR: &str = concat!(PROXMOX_BACKUP_STATE_DIR_M!(), "/rrdb");
pub static RRD_CACHE: OnceCell<RRDCache> = OnceCell::new(); static RRD_CACHE: OnceCell<RRDCache> = OnceCell::new();
/// Get the RRD cache instance /// Get the RRD cache instance
pub fn get_rrd_cache() -> Result<&'static RRDCache, Error> { pub fn get_rrd_cache() -> Result<&'static RRDCache, Error> {