src/api2/admin/datastore/backup/upload_chunk.rs: rename upload_dynamic_chunk into upload_chunk

This commit is contained in:
Dietmar Maurer 2019-05-27 07:57:43 +02:00
parent 771953f9eb
commit a1e7cff3ea
3 changed files with 9 additions and 18 deletions

View File

@ -146,8 +146,8 @@ fn backup_api() -> Router {
let router = Router::new()
.subdir(
"dynamic_chunk", Router::new()
.upload(api_method_upload_dynamic_chunk())
"upload_chunk", Router::new()
.upload(api_method_upload_chunk())
)
.subdir(
"dynamic_index", Router::new()

View File

@ -54,17 +54,10 @@ impl Future for UploadChunk {
}
}
pub fn api_method_upload_dynamic_chunk() -> ApiAsyncMethod {
pub fn api_method_upload_chunk() -> ApiAsyncMethod {
ApiAsyncMethod::new(
upload_dynamic_chunk,
ObjectSchema::new("Upload chunk for dynamic index writer (variable sized chunks).")
.required("wid", IntegerSchema::new("Dynamic writer ID.")
.minimum(1)
.maximum(256)
)
.required("offset", IntegerSchema::new("Chunk offset (end of chunk).")
.minimum(0)
)
upload_chunk,
ObjectSchema::new("Upload a new chunk.")
.required("size", IntegerSchema::new("Chunk size.")
.minimum(1)
.maximum(1024*1024*16)
@ -72,7 +65,7 @@ pub fn api_method_upload_dynamic_chunk() -> ApiAsyncMethod {
)
}
fn upload_dynamic_chunk(
fn upload_chunk(
_parts: Parts,
req_body: Body,
param: Value,
@ -81,10 +74,8 @@ fn upload_dynamic_chunk(
) -> Result<BoxFut, Error> {
let size = tools::required_integer_param(&param, "size")? as u32;
let offset = tools::required_integer_param(&param, "offset")? as u64;
let wid = tools::required_integer_param(&param, "wid")? as usize;
println!("upload_dynamic_chunk: {} bytes, offset {}", size, offset);
println!("upload_chunk: {} bytes", size);
let env: &BackupEnvironment = rpcenv.as_ref();

View File

@ -652,8 +652,8 @@ impl BackupClient {
println!("upload new chunk {} ({} bytes, offset {})", tools::digest_to_hex(&digest),
chunk_info.data.len(), offset);
let param = json!({ "wid": wid, "offset": offset, "size" : chunk_info.data.len() });
let request = H2Client::request_builder("localhost", "POST", "dynamic_chunk", Some(param)).unwrap();
let param = json!({ "size" : chunk_info.data.len() });
let request = H2Client::request_builder("localhost", "POST", "upload_chunk", Some(param)).unwrap();
let upload_data = Some(chunk_info.data.freeze());
let new_info = MergedChunkInfo::Known(vec![(chunk_info.offset, chunk_info.digest)]);