api-types: introduce BackupType enum and Group/Dir api types

The type is a real enum.

All are API types and implement Display and FromStr. The
ordering is the same as it is in pbs-datastore.

Also, they are now flattened into a few structs instead of
being copied manually.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Wolfgang Bumiller
2022-04-14 15:05:58 +02:00
committed by Thomas Lamprecht
parent 33eb23d57e
commit 988d575dbb
23 changed files with 449 additions and 278 deletions

View File

@ -2,7 +2,7 @@ use std::io::Write;
use anyhow::Error;
use pbs_api_types::Authid;
use pbs_api_types::{Authid, BackupType};
use pbs_client::{BackupReader, HttpClient, HttpClientOptions};
pub struct DummyWriter {
@ -33,8 +33,16 @@ async fn run() -> Result<(), Error> {
let backup_time = proxmox_time::parse_rfc3339("2019-06-28T10:49:48Z")?;
let client =
BackupReader::start(client, None, "store2", "host", "elsa", backup_time, true).await?;
let client = BackupReader::start(
client,
None,
"store2",
BackupType::Host,
"elsa",
backup_time,
true,
)
.await?;
let start = std::time::SystemTime::now();

View File

@ -1,6 +1,6 @@
use anyhow::Error;
use pbs_api_types::Authid;
use pbs_api_types::{Authid, BackupType};
use pbs_client::{BackupWriter, HttpClient, HttpClientOptions};
async fn upload_speed() -> Result<f64, Error> {
@ -21,7 +21,7 @@ async fn upload_speed() -> Result<f64, Error> {
client,
None,
datastore,
"host",
BackupType::Host,
"speedtest",
backup_time,
false,