split out pbs-runtime module
These are mostly tokio specific "hacks" or "workarounds" we only really need/want in our binaries without pulling it in via our library crates. Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
@ -218,7 +218,7 @@ async move {
|
||||
};
|
||||
if benchmark {
|
||||
env.log("benchmark finished successfully");
|
||||
tools::runtime::block_in_place(|| env.remove_backup())?;
|
||||
pbs_runtime::block_in_place(|| env.remove_backup())?;
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
@ -246,13 +246,13 @@ async move {
|
||||
(Ok(_), Err(err)) => {
|
||||
env.log(format!("backup ended and finish failed: {}", err));
|
||||
env.log("removing unfinished backup");
|
||||
tools::runtime::block_in_place(|| env.remove_backup())?;
|
||||
pbs_runtime::block_in_place(|| env.remove_backup())?;
|
||||
Err(err)
|
||||
},
|
||||
(Err(err), Err(_)) => {
|
||||
env.log(format!("backup failed: {}", err));
|
||||
env.log("removing failed backup");
|
||||
tools::runtime::block_in_place(|| env.remove_backup())?;
|
||||
pbs_runtime::block_in_place(|| env.remove_backup())?;
|
||||
Err(err)
|
||||
},
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ impl Future for UploadChunk {
|
||||
let (is_duplicate, compressed_size) = match proxmox::try_block! {
|
||||
let mut chunk = DataBlob::from_raw(raw_data)?;
|
||||
|
||||
tools::runtime::block_in_place(|| {
|
||||
pbs_runtime::block_in_place(|| {
|
||||
chunk.verify_unencrypted(this.size as usize, &this.digest)?;
|
||||
|
||||
// always comput CRC at server side
|
||||
|
@ -236,7 +236,7 @@ fn apt_get_changelog(
|
||||
let changelog_url = &pkg_info[0].change_log_url;
|
||||
// FIXME: use 'apt-get changelog' for proxmox packages as well, once repo supports it
|
||||
if changelog_url.starts_with("http://download.proxmox.com/") {
|
||||
let changelog = crate::tools::runtime::block_on(client.get_string(changelog_url, None))
|
||||
let changelog = pbs_runtime::block_on(client.get_string(changelog_url, None))
|
||||
.map_err(|err| format_err!("Error downloading changelog from '{}': {}", changelog_url, err))?;
|
||||
Ok(json!(changelog))
|
||||
|
||||
@ -260,7 +260,7 @@ fn apt_get_changelog(
|
||||
auth_header.insert("Authorization".to_owned(),
|
||||
format!("Basic {}", base64::encode(format!("{}:{}", key, id))));
|
||||
|
||||
let changelog = crate::tools::runtime::block_on(client.get_string(changelog_url, Some(&auth_header)))
|
||||
let changelog = pbs_runtime::block_on(client.get_string(changelog_url, Some(&auth_header)))
|
||||
.map_err(|err| format_err!("Error downloading changelog from '{}': {}", changelog_url, err))?;
|
||||
Ok(json!(changelog))
|
||||
|
||||
|
@ -322,7 +322,7 @@ fn download_chunk(
|
||||
|
||||
env.debug(format!("download chunk {:?}", path));
|
||||
|
||||
let data = tools::runtime::block_in_place(|| std::fs::read(path))
|
||||
let data = pbs_runtime::block_in_place(|| std::fs::read(path))
|
||||
.map_err(move |err| http_err!(BAD_REQUEST, "reading file {:?} failed: {}", path2, err))?;
|
||||
|
||||
let body = Body::from(data);
|
||||
|
Reference in New Issue
Block a user