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:
committed by
Thomas Lamprecht
parent
33eb23d57e
commit
988d575dbb
@ -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();
|
||||
|
||||
|
@ -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,
|
||||
|
Reference in New Issue
Block a user