rename ApiHandler::Async into ApiHandler::AsyncHttp

This commit is contained in:
Dietmar Maurer 2019-11-23 09:03:21 +01:00
parent 70fbac84da
commit 329d40b50b
6 changed files with 19 additions and 17 deletions

View File

@ -521,7 +521,7 @@ fn download_file(
#[sortable]
pub const API_METHOD_DOWNLOAD_FILE: ApiMethod = ApiMethod::new(
&ApiHandler::Async(&download_file),
&ApiHandler::AsyncHttp(&download_file),
&ObjectSchema::new(
"Download single raw file from backup snapshot.",
&sorted!([
@ -590,7 +590,7 @@ fn upload_backup_log(
#[sortable]
pub const API_METHOD_UPLOAD_BACKUP_LOG: ApiMethod = ApiMethod::new(
&ApiHandler::Async(&upload_backup_log),
&ApiHandler::AsyncHttp(&upload_backup_log),
&ObjectSchema::new(
"Download single raw file from backup snapshot.",
&sorted!([

View File

@ -28,7 +28,7 @@ pub const ROUTER: Router = Router::new()
#[sortable]
pub const API_METHOD_UPGRADE_BACKUP: ApiMethod = ApiMethod::new(
&ApiHandler::Async(&upgrade_to_backup_protocol),
&ApiHandler::AsyncHttp(&upgrade_to_backup_protocol),
&ObjectSchema::new(
concat!("Upgraded to backup protocol ('", PROXMOX_BACKUP_PROTOCOL_ID_V1!(), "')."),
&sorted!([
@ -553,7 +553,7 @@ fn finish_backup (
#[sortable]
pub const API_METHOD_DYNAMIC_CHUNK_INDEX: ApiMethod = ApiMethod::new(
&ApiHandler::Async(&dynamic_chunk_index),
&ApiHandler::AsyncHttp(&dynamic_chunk_index),
&ObjectSchema::new(
r###"
Download the dynamic chunk index from the previous backup.
@ -628,7 +628,7 @@ fn dynamic_chunk_index(
#[sortable]
pub const API_METHOD_FIXED_CHUNK_INDEX: ApiMethod = ApiMethod::new(
&ApiHandler::Async(&fixed_chunk_index),
&ApiHandler::AsyncHttp(&fixed_chunk_index),
&ObjectSchema::new(
r###"
Download the fixed chunk index from the previous backup.

View File

@ -85,7 +85,7 @@ impl Future for UploadChunk {
#[sortable]
pub const API_METHOD_UPLOAD_FIXED_CHUNK: ApiMethod = ApiMethod::new(
&ApiHandler::Async(&upload_fixed_chunk),
&ApiHandler::AsyncHttp(&upload_fixed_chunk),
&ObjectSchema::new(
"Upload a new chunk.",
&sorted!([
@ -143,7 +143,7 @@ fn upload_fixed_chunk(
#[sortable]
pub const API_METHOD_UPLOAD_DYNAMIC_CHUNK: ApiMethod = ApiMethod::new(
&ApiHandler::Async(&upload_dynamic_chunk),
&ApiHandler::AsyncHttp(&upload_dynamic_chunk),
&ObjectSchema::new(
"Upload a new chunk.",
&sorted!([
@ -199,7 +199,7 @@ fn upload_dynamic_chunk(
}
pub const API_METHOD_UPLOAD_SPEEDTEST: ApiMethod = ApiMethod::new(
&ApiHandler::Async(&upload_speedtest),
&ApiHandler::AsyncHttp(&upload_speedtest),
&ObjectSchema::new("Test upload speed.", &[])
);
@ -237,7 +237,7 @@ fn upload_speedtest(
#[sortable]
pub const API_METHOD_UPLOAD_BLOB: ApiMethod = ApiMethod::new(
&ApiHandler::Async(&upload_blob),
&ApiHandler::AsyncHttp(&upload_blob),
&ObjectSchema::new(
"Upload binary blob file.",
&sorted!([

View File

@ -24,7 +24,7 @@ pub const ROUTER: Router = Router::new()
#[sortable]
pub const API_METHOD_UPGRADE_BACKUP: ApiMethod = ApiMethod::new(
&ApiHandler::Async(&upgrade_to_backup_reader_protocol),
&ApiHandler::AsyncHttp(&upgrade_to_backup_reader_protocol),
&ObjectSchema::new(
concat!("Upgraded to backup protocol ('", PROXMOX_BACKUP_READER_PROTOCOL_ID_V1!(), "')."),
&sorted!([
@ -157,7 +157,7 @@ pub const READER_API_ROUTER: Router = Router::new()
#[sortable]
pub const API_METHOD_DOWNLOAD_FILE: ApiMethod = ApiMethod::new(
&ApiHandler::Async(&download_file),
&ApiHandler::AsyncHttp(&download_file),
&ObjectSchema::new(
"Download specified file.",
&sorted!([
@ -208,7 +208,7 @@ fn download_file(
#[sortable]
pub const API_METHOD_DOWNLOAD_CHUNK: ApiMethod = ApiMethod::new(
&ApiHandler::Async(&download_chunk),
&ApiHandler::AsyncHttp(&download_chunk),
&ObjectSchema::new(
"Download specified chunk.",
&sorted!([
@ -293,7 +293,7 @@ fn download_chunk_old(
*/
pub const API_METHOD_SPEEDTEST: ApiMethod = ApiMethod::new(
&ApiHandler::Async(&speedtest),
&ApiHandler::AsyncHttp(&speedtest),
&ObjectSchema::new("Test 4M block download speed.", &[])
);

View File

@ -201,9 +201,11 @@ fn handle_simple_command(
}
}
}
ApiHandler::Async(_) => {
//fixme
unimplemented!();
ApiHandler::AsyncHttp(_) => {
let err = format_err!(
"CliHandler does not support ApiHandler::AsyncHttp - internal error");
print_simple_usage_error(prefix, cli_cmd, err);
std::process::exit(-1);
}
}
}

View File

@ -275,7 +275,7 @@ pub async fn handle_api_request<Env: RpcEnvironment, S: 'static + BuildHasher +
let delay_unauth_time = std::time::Instant::now() + std::time::Duration::from_millis(3000);
let result = match info.handler {
ApiHandler::Async(handler) => {
ApiHandler::AsyncHttp(handler) => {
let params = parse_query_parameters(info.parameters, "", &parts, &uri_param)?;
(handler)(parts, req_body, params, info, Box::new(rpcenv)).await
}