diff --git a/pbs-api-types/src/lib.rs b/pbs-api-types/src/lib.rs index 00d1e3a5..a95cbf6a 100644 --- a/pbs-api-types/src/lib.rs +++ b/pbs-api-types/src/lib.rs @@ -470,3 +470,58 @@ pub struct PruneListItem { /// Keep snapshot pub keep: bool, } + +#[api()] +#[derive(Default, Serialize, Deserialize)] +/// Storage space usage information. +pub struct StorageStatus { + /// Total space (bytes). + pub total: u64, + /// Used space (bytes). + pub used: u64, + /// Available space (bytes). + pub avail: u64, +} + +#[api()] +#[derive(Serialize, Deserialize, Default)] +/// Backup Type group/snapshot counts. +pub struct TypeCounts { + /// The number of groups of the type. + pub groups: u64, + /// The number of snapshots of the type. + pub snapshots: u64, +} + +#[api( + properties: { + ct: { + type: TypeCounts, + optional: true, + }, + host: { + type: TypeCounts, + optional: true, + }, + vm: { + type: TypeCounts, + optional: true, + }, + other: { + type: TypeCounts, + optional: true, + }, + }, +)] +#[derive(Serialize, Deserialize, Default)] +/// Counts of groups/snapshots per BackupType. +pub struct Counts { + /// The counts for CT backups + pub ct: Option, + /// The counts for Host backups + pub host: Option, + /// The counts for VM backups + pub vm: Option, + /// The counts for other backup types + pub other: Option, +} diff --git a/src/api2/types/mod.rs b/src/api2/types/mod.rs index 530ce904..02a538fa 100644 --- a/src/api2/types/mod.rs +++ b/src/api2/types/mod.rs @@ -349,61 +349,6 @@ pub const REALM_ID_SCHEMA: Schema = StringSchema::new("Realm name.") // Complex type definitions -#[api()] -#[derive(Default, Serialize, Deserialize)] -/// Storage space usage information. -pub struct StorageStatus { - /// Total space (bytes). - pub total: u64, - /// Used space (bytes). - pub used: u64, - /// Available space (bytes). - pub avail: u64, -} - -#[api()] -#[derive(Serialize, Deserialize, Default)] -/// Backup Type group/snapshot counts. -pub struct TypeCounts { - /// The number of groups of the type. - pub groups: u64, - /// The number of snapshots of the type. - pub snapshots: u64, -} - -#[api( - properties: { - ct: { - type: TypeCounts, - optional: true, - }, - host: { - type: TypeCounts, - optional: true, - }, - vm: { - type: TypeCounts, - optional: true, - }, - other: { - type: TypeCounts, - optional: true, - }, - }, -)] -#[derive(Serialize, Deserialize, Default)] -/// Counts of groups/snapshots per BackupType. -pub struct Counts { - /// The counts for CT backups - pub ct: Option, - /// The counts for Host backups - pub host: Option, - /// The counts for VM backups - pub vm: Option, - /// The counts for other backup types - pub other: Option, -} - #[api( properties: { "gc-status": { diff --git a/src/bin/proxmox-backup-client.rs b/src/bin/proxmox-backup-client.rs index e2068979..d4fa9448 100644 --- a/src/bin/proxmox-backup-client.rs +++ b/src/bin/proxmox-backup-client.rs @@ -27,7 +27,10 @@ use proxmox::{ }; use pxar::accessor::{MaybeReady, ReadAt, ReadAtOperation}; -use pbs_api_types::CryptMode; +use pbs_api_types::{ + BACKUP_ID_SCHEMA, BACKUP_TIME_SCHEMA, BACKUP_TYPE_SCHEMA, Authid, CryptMode, GroupListItem, + PruneListItem, SnapshotListItem, StorageStatus, +}; use pbs_client::{ BACKUP_SOURCE_SCHEMA, BackupReader, @@ -55,32 +58,25 @@ use pbs_client::tools::{ }, CHUNK_SIZE_SCHEMA, REPO_URL_SCHEMA, }; -use pbs_datastore::CryptConfig; +use pbs_datastore::{CATALOG_NAME, CryptConfig, KeyConfig, decrypt_key, rsa_encrypt_key_config}; use pbs_datastore::backup_info::{BackupDir, BackupGroup}; -use pbs_datastore::catalog::BackupCatalogWriter; +use pbs_datastore::catalog::{BackupCatalogWriter, CatalogReader, CatalogWriter}; +use pbs_datastore::chunk_store::verify_chunk_size; use pbs_datastore::dynamic_index::DynamicIndexReader; use pbs_datastore::fixed_index::FixedIndexReader; use pbs_datastore::index::IndexFile; -use pbs_datastore::manifest::{MANIFEST_BLOB_NAME, ArchiveType, BackupManifest, archive_type}; +use pbs_datastore::manifest::{ + ENCRYPTED_KEY_BLOB_NAME, MANIFEST_BLOB_NAME, ArchiveType, BackupManifest, archive_type, +}; use pbs_datastore::read_chunk::AsyncReadChunk; +use pbs_datastore::prune::PruneOptions; use pbs_tools::sync::StdChannelWriter; use pbs_tools::tokio::TokioWriterAdapter; -use proxmox_backup::api2::types::*; -use proxmox_backup::api2::version; use proxmox_backup::backup::{ - decrypt_key, - rsa_encrypt_key_config, - verify_chunk_size, BufferedDynamicReader, - CATALOG_NAME, - CatalogReader, - CatalogWriter, ChunkStream, - ENCRYPTED_KEY_BLOB_NAME, FixedChunkStream, - KeyConfig, - PruneOptions, }; use proxmox_backup::tools;