rename ApiHandler::Async into ApiHandler::AsyncHttp
This commit is contained in:
parent
70fbac84da
commit
329d40b50b
|
@ -521,7 +521,7 @@ fn download_file(
|
||||||
|
|
||||||
#[sortable]
|
#[sortable]
|
||||||
pub const API_METHOD_DOWNLOAD_FILE: ApiMethod = ApiMethod::new(
|
pub const API_METHOD_DOWNLOAD_FILE: ApiMethod = ApiMethod::new(
|
||||||
&ApiHandler::Async(&download_file),
|
&ApiHandler::AsyncHttp(&download_file),
|
||||||
&ObjectSchema::new(
|
&ObjectSchema::new(
|
||||||
"Download single raw file from backup snapshot.",
|
"Download single raw file from backup snapshot.",
|
||||||
&sorted!([
|
&sorted!([
|
||||||
|
@ -590,7 +590,7 @@ fn upload_backup_log(
|
||||||
|
|
||||||
#[sortable]
|
#[sortable]
|
||||||
pub const API_METHOD_UPLOAD_BACKUP_LOG: ApiMethod = ApiMethod::new(
|
pub const API_METHOD_UPLOAD_BACKUP_LOG: ApiMethod = ApiMethod::new(
|
||||||
&ApiHandler::Async(&upload_backup_log),
|
&ApiHandler::AsyncHttp(&upload_backup_log),
|
||||||
&ObjectSchema::new(
|
&ObjectSchema::new(
|
||||||
"Download single raw file from backup snapshot.",
|
"Download single raw file from backup snapshot.",
|
||||||
&sorted!([
|
&sorted!([
|
||||||
|
|
|
@ -28,7 +28,7 @@ pub const ROUTER: Router = Router::new()
|
||||||
|
|
||||||
#[sortable]
|
#[sortable]
|
||||||
pub const API_METHOD_UPGRADE_BACKUP: ApiMethod = ApiMethod::new(
|
pub const API_METHOD_UPGRADE_BACKUP: ApiMethod = ApiMethod::new(
|
||||||
&ApiHandler::Async(&upgrade_to_backup_protocol),
|
&ApiHandler::AsyncHttp(&upgrade_to_backup_protocol),
|
||||||
&ObjectSchema::new(
|
&ObjectSchema::new(
|
||||||
concat!("Upgraded to backup protocol ('", PROXMOX_BACKUP_PROTOCOL_ID_V1!(), "')."),
|
concat!("Upgraded to backup protocol ('", PROXMOX_BACKUP_PROTOCOL_ID_V1!(), "')."),
|
||||||
&sorted!([
|
&sorted!([
|
||||||
|
@ -553,7 +553,7 @@ fn finish_backup (
|
||||||
|
|
||||||
#[sortable]
|
#[sortable]
|
||||||
pub const API_METHOD_DYNAMIC_CHUNK_INDEX: ApiMethod = ApiMethod::new(
|
pub const API_METHOD_DYNAMIC_CHUNK_INDEX: ApiMethod = ApiMethod::new(
|
||||||
&ApiHandler::Async(&dynamic_chunk_index),
|
&ApiHandler::AsyncHttp(&dynamic_chunk_index),
|
||||||
&ObjectSchema::new(
|
&ObjectSchema::new(
|
||||||
r###"
|
r###"
|
||||||
Download the dynamic chunk index from the previous backup.
|
Download the dynamic chunk index from the previous backup.
|
||||||
|
@ -628,7 +628,7 @@ fn dynamic_chunk_index(
|
||||||
|
|
||||||
#[sortable]
|
#[sortable]
|
||||||
pub const API_METHOD_FIXED_CHUNK_INDEX: ApiMethod = ApiMethod::new(
|
pub const API_METHOD_FIXED_CHUNK_INDEX: ApiMethod = ApiMethod::new(
|
||||||
&ApiHandler::Async(&fixed_chunk_index),
|
&ApiHandler::AsyncHttp(&fixed_chunk_index),
|
||||||
&ObjectSchema::new(
|
&ObjectSchema::new(
|
||||||
r###"
|
r###"
|
||||||
Download the fixed chunk index from the previous backup.
|
Download the fixed chunk index from the previous backup.
|
||||||
|
|
|
@ -85,7 +85,7 @@ impl Future for UploadChunk {
|
||||||
|
|
||||||
#[sortable]
|
#[sortable]
|
||||||
pub const API_METHOD_UPLOAD_FIXED_CHUNK: ApiMethod = ApiMethod::new(
|
pub const API_METHOD_UPLOAD_FIXED_CHUNK: ApiMethod = ApiMethod::new(
|
||||||
&ApiHandler::Async(&upload_fixed_chunk),
|
&ApiHandler::AsyncHttp(&upload_fixed_chunk),
|
||||||
&ObjectSchema::new(
|
&ObjectSchema::new(
|
||||||
"Upload a new chunk.",
|
"Upload a new chunk.",
|
||||||
&sorted!([
|
&sorted!([
|
||||||
|
@ -143,7 +143,7 @@ fn upload_fixed_chunk(
|
||||||
|
|
||||||
#[sortable]
|
#[sortable]
|
||||||
pub const API_METHOD_UPLOAD_DYNAMIC_CHUNK: ApiMethod = ApiMethod::new(
|
pub const API_METHOD_UPLOAD_DYNAMIC_CHUNK: ApiMethod = ApiMethod::new(
|
||||||
&ApiHandler::Async(&upload_dynamic_chunk),
|
&ApiHandler::AsyncHttp(&upload_dynamic_chunk),
|
||||||
&ObjectSchema::new(
|
&ObjectSchema::new(
|
||||||
"Upload a new chunk.",
|
"Upload a new chunk.",
|
||||||
&sorted!([
|
&sorted!([
|
||||||
|
@ -199,7 +199,7 @@ fn upload_dynamic_chunk(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const API_METHOD_UPLOAD_SPEEDTEST: ApiMethod = ApiMethod::new(
|
pub const API_METHOD_UPLOAD_SPEEDTEST: ApiMethod = ApiMethod::new(
|
||||||
&ApiHandler::Async(&upload_speedtest),
|
&ApiHandler::AsyncHttp(&upload_speedtest),
|
||||||
&ObjectSchema::new("Test upload speed.", &[])
|
&ObjectSchema::new("Test upload speed.", &[])
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ fn upload_speedtest(
|
||||||
|
|
||||||
#[sortable]
|
#[sortable]
|
||||||
pub const API_METHOD_UPLOAD_BLOB: ApiMethod = ApiMethod::new(
|
pub const API_METHOD_UPLOAD_BLOB: ApiMethod = ApiMethod::new(
|
||||||
&ApiHandler::Async(&upload_blob),
|
&ApiHandler::AsyncHttp(&upload_blob),
|
||||||
&ObjectSchema::new(
|
&ObjectSchema::new(
|
||||||
"Upload binary blob file.",
|
"Upload binary blob file.",
|
||||||
&sorted!([
|
&sorted!([
|
||||||
|
|
|
@ -24,7 +24,7 @@ pub const ROUTER: Router = Router::new()
|
||||||
|
|
||||||
#[sortable]
|
#[sortable]
|
||||||
pub const API_METHOD_UPGRADE_BACKUP: ApiMethod = ApiMethod::new(
|
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(
|
&ObjectSchema::new(
|
||||||
concat!("Upgraded to backup protocol ('", PROXMOX_BACKUP_READER_PROTOCOL_ID_V1!(), "')."),
|
concat!("Upgraded to backup protocol ('", PROXMOX_BACKUP_READER_PROTOCOL_ID_V1!(), "')."),
|
||||||
&sorted!([
|
&sorted!([
|
||||||
|
@ -157,7 +157,7 @@ pub const READER_API_ROUTER: Router = Router::new()
|
||||||
|
|
||||||
#[sortable]
|
#[sortable]
|
||||||
pub const API_METHOD_DOWNLOAD_FILE: ApiMethod = ApiMethod::new(
|
pub const API_METHOD_DOWNLOAD_FILE: ApiMethod = ApiMethod::new(
|
||||||
&ApiHandler::Async(&download_file),
|
&ApiHandler::AsyncHttp(&download_file),
|
||||||
&ObjectSchema::new(
|
&ObjectSchema::new(
|
||||||
"Download specified file.",
|
"Download specified file.",
|
||||||
&sorted!([
|
&sorted!([
|
||||||
|
@ -208,7 +208,7 @@ fn download_file(
|
||||||
|
|
||||||
#[sortable]
|
#[sortable]
|
||||||
pub const API_METHOD_DOWNLOAD_CHUNK: ApiMethod = ApiMethod::new(
|
pub const API_METHOD_DOWNLOAD_CHUNK: ApiMethod = ApiMethod::new(
|
||||||
&ApiHandler::Async(&download_chunk),
|
&ApiHandler::AsyncHttp(&download_chunk),
|
||||||
&ObjectSchema::new(
|
&ObjectSchema::new(
|
||||||
"Download specified chunk.",
|
"Download specified chunk.",
|
||||||
&sorted!([
|
&sorted!([
|
||||||
|
@ -293,7 +293,7 @@ fn download_chunk_old(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pub const API_METHOD_SPEEDTEST: ApiMethod = ApiMethod::new(
|
pub const API_METHOD_SPEEDTEST: ApiMethod = ApiMethod::new(
|
||||||
&ApiHandler::Async(&speedtest),
|
&ApiHandler::AsyncHttp(&speedtest),
|
||||||
&ObjectSchema::new("Test 4M block download speed.", &[])
|
&ObjectSchema::new("Test 4M block download speed.", &[])
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -201,9 +201,11 @@ fn handle_simple_command(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ApiHandler::Async(_) => {
|
ApiHandler::AsyncHttp(_) => {
|
||||||
//fixme
|
let err = format_err!(
|
||||||
unimplemented!();
|
"CliHandler does not support ApiHandler::AsyncHttp - internal error");
|
||||||
|
print_simple_usage_error(prefix, cli_cmd, err);
|
||||||
|
std::process::exit(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 delay_unauth_time = std::time::Instant::now() + std::time::Duration::from_millis(3000);
|
||||||
|
|
||||||
let result = match info.handler {
|
let result = match info.handler {
|
||||||
ApiHandler::Async(handler) => {
|
ApiHandler::AsyncHttp(handler) => {
|
||||||
let params = parse_query_parameters(info.parameters, "", &parts, &uri_param)?;
|
let params = parse_query_parameters(info.parameters, "", &parts, &uri_param)?;
|
||||||
(handler)(parts, req_body, params, info, Box::new(rpcenv)).await
|
(handler)(parts, req_body, params, info, Box::new(rpcenv)).await
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue