move chunk_store to pbs-datastore
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
@ -1,5 +1,8 @@
|
||||
//! Basic API types used by most of the PBS code.
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use proxmox::api::api;
|
||||
use proxmox::api::schema::{ApiStringFormat, Schema, StringSchema};
|
||||
use proxmox::const_regex;
|
||||
|
||||
@ -37,6 +40,7 @@ pub use userid::{Username, UsernameRef};
|
||||
pub use userid::{PROXMOX_GROUP_ID_SCHEMA, PROXMOX_TOKEN_ID_SCHEMA, PROXMOX_TOKEN_NAME_SCHEMA};
|
||||
|
||||
pub mod upid;
|
||||
pub use upid::UPID;
|
||||
|
||||
const_regex! {
|
||||
pub BACKUP_TYPE_REGEX = concat!(r"^(", BACKUP_TYPE_RE!(), r")$");
|
||||
@ -84,3 +88,56 @@ pub const SINGLE_LINE_COMMENT_SCHEMA: Schema = StringSchema::new("Comment (singl
|
||||
.schema();
|
||||
|
||||
pub const BACKUP_ID_FORMAT: ApiStringFormat = ApiStringFormat::Pattern(&BACKUP_ID_REGEX);
|
||||
|
||||
#[api(
|
||||
properties: {
|
||||
"upid": {
|
||||
optional: true,
|
||||
type: UPID,
|
||||
},
|
||||
},
|
||||
)]
|
||||
#[derive(Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
/// Garbage collection status.
|
||||
pub struct GarbageCollectionStatus {
|
||||
pub upid: Option<String>,
|
||||
/// Number of processed index files.
|
||||
pub index_file_count: usize,
|
||||
/// Sum of bytes referred by index files.
|
||||
pub index_data_bytes: u64,
|
||||
/// Bytes used on disk.
|
||||
pub disk_bytes: u64,
|
||||
/// Chunks used on disk.
|
||||
pub disk_chunks: usize,
|
||||
/// Sum of removed bytes.
|
||||
pub removed_bytes: u64,
|
||||
/// Number of removed chunks.
|
||||
pub removed_chunks: usize,
|
||||
/// Sum of pending bytes (pending removal - kept for safety).
|
||||
pub pending_bytes: u64,
|
||||
/// Number of pending chunks (pending removal - kept for safety).
|
||||
pub pending_chunks: usize,
|
||||
/// Number of chunks marked as .bad by verify that have been removed by GC.
|
||||
pub removed_bad: usize,
|
||||
/// Number of chunks still marked as .bad after garbage collection.
|
||||
pub still_bad: usize,
|
||||
}
|
||||
|
||||
impl Default for GarbageCollectionStatus {
|
||||
fn default() -> Self {
|
||||
GarbageCollectionStatus {
|
||||
upid: None,
|
||||
index_file_count: 0,
|
||||
index_data_bytes: 0,
|
||||
disk_bytes: 0,
|
||||
disk_chunks: 0,
|
||||
removed_bytes: 0,
|
||||
removed_chunks: 0,
|
||||
pending_bytes: 0,
|
||||
pending_chunks: 0,
|
||||
removed_bad: 0,
|
||||
still_bad: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user