]>
git.proxmox.com Git - proxmox-backup.git/blob - examples/upload-speed.rs
3 use proxmox_backup
::api2
::types
::Userid
;
4 use proxmox_backup
::client
::*;
6 async
fn upload_speed() -> Result
<f64, Error
> {
8 let host
= "localhost";
9 let datastore
= "store2";
11 let username
= Userid
::root_userid();
13 let options
= HttpClientOptions
::new()
17 let client
= HttpClient
::new(host
, 8007, username
, options
)?
;
19 let backup_time
= proxmox
::tools
::time
::epoch_i64();
21 let client
= BackupWriter
::start(client
, None
, datastore
, "host", "speedtest", backup_time
, false, true).await?
;
23 println
!("start upload speed test");
24 let res
= client
.upload_speedtest(true).await?
;
30 match proxmox_backup
::tools
::runtime
::main(upload_speed()) {
32 println
!("average upload speed: {} MB/s", mbs
);
35 eprintln
!("ERROR: {}", err
);