mirror of
git://git.proxmox.com/git/proxmox-backup.git
synced 2025-01-25 06:03:57 +03:00
eb13d9151a
commit 323b2f3dd6364119f2ffcd7397161e9f56cdb3fc changed the signature of upload_speedtest adapt the example Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
38 lines
869 B
Rust
38 lines
869 B
Rust
use anyhow::{Error};
|
|
|
|
use proxmox_backup::client::*;
|
|
|
|
async fn upload_speed() -> Result<f64, Error> {
|
|
|
|
let host = "localhost";
|
|
let datastore = "store2";
|
|
|
|
let username = "root@pam";
|
|
|
|
let options = HttpClientOptions::new()
|
|
.interactive(true)
|
|
.ticket_cache(true);
|
|
|
|
let client = HttpClient::new(host, username, options)?;
|
|
|
|
let backup_time = chrono::Utc::now();
|
|
|
|
let client = BackupWriter::start(client, None, datastore, "host", "speedtest", backup_time, false).await?;
|
|
|
|
println!("start upload speed test");
|
|
let res = client.upload_speedtest(true).await?;
|
|
|
|
Ok(res)
|
|
}
|
|
|
|
fn main() {
|
|
match proxmox_backup::tools::runtime::main(upload_speed()) {
|
|
Ok(mbs) => {
|
|
println!("average upload speed: {} MB/s", mbs);
|
|
}
|
|
Err(err) => {
|
|
eprintln!("ERROR: {}", err);
|
|
}
|
|
}
|
|
}
|