src/api2/admin/datastore/backup/upload_chunk.rs: rename upload_dynamic_chunk into upload_chunk
This commit is contained in:
parent
771953f9eb
commit
a1e7cff3ea
@ -146,8 +146,8 @@ fn backup_api() -> Router {
|
|||||||
|
|
||||||
let router = Router::new()
|
let router = Router::new()
|
||||||
.subdir(
|
.subdir(
|
||||||
"dynamic_chunk", Router::new()
|
"upload_chunk", Router::new()
|
||||||
.upload(api_method_upload_dynamic_chunk())
|
.upload(api_method_upload_chunk())
|
||||||
)
|
)
|
||||||
.subdir(
|
.subdir(
|
||||||
"dynamic_index", Router::new()
|
"dynamic_index", Router::new()
|
||||||
|
@ -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(
|
ApiAsyncMethod::new(
|
||||||
upload_dynamic_chunk,
|
upload_chunk,
|
||||||
ObjectSchema::new("Upload chunk for dynamic index writer (variable sized chunks).")
|
ObjectSchema::new("Upload a new chunk.")
|
||||||
.required("wid", IntegerSchema::new("Dynamic writer ID.")
|
|
||||||
.minimum(1)
|
|
||||||
.maximum(256)
|
|
||||||
)
|
|
||||||
.required("offset", IntegerSchema::new("Chunk offset (end of chunk).")
|
|
||||||
.minimum(0)
|
|
||||||
)
|
|
||||||
.required("size", IntegerSchema::new("Chunk size.")
|
.required("size", IntegerSchema::new("Chunk size.")
|
||||||
.minimum(1)
|
.minimum(1)
|
||||||
.maximum(1024*1024*16)
|
.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,
|
_parts: Parts,
|
||||||
req_body: Body,
|
req_body: Body,
|
||||||
param: Value,
|
param: Value,
|
||||||
@ -81,10 +74,8 @@ fn upload_dynamic_chunk(
|
|||||||
) -> Result<BoxFut, Error> {
|
) -> Result<BoxFut, Error> {
|
||||||
|
|
||||||
let size = tools::required_integer_param(¶m, "size")? as u32;
|
let size = tools::required_integer_param(¶m, "size")? as u32;
|
||||||
let offset = tools::required_integer_param(¶m, "offset")? as u64;
|
|
||||||
let wid = tools::required_integer_param(¶m, "wid")? as usize;
|
|
||||||
|
|
||||||
println!("upload_dynamic_chunk: {} bytes, offset {}", size, offset);
|
println!("upload_chunk: {} bytes", size);
|
||||||
|
|
||||||
let env: &BackupEnvironment = rpcenv.as_ref();
|
let env: &BackupEnvironment = rpcenv.as_ref();
|
||||||
|
|
||||||
|
@ -652,8 +652,8 @@ impl BackupClient {
|
|||||||
println!("upload new chunk {} ({} bytes, offset {})", tools::digest_to_hex(&digest),
|
println!("upload new chunk {} ({} bytes, offset {})", tools::digest_to_hex(&digest),
|
||||||
chunk_info.data.len(), offset);
|
chunk_info.data.len(), offset);
|
||||||
|
|
||||||
let param = json!({ "wid": wid, "offset": offset, "size" : chunk_info.data.len() });
|
let param = json!({ "size" : chunk_info.data.len() });
|
||||||
let request = H2Client::request_builder("localhost", "POST", "dynamic_chunk", Some(param)).unwrap();
|
let request = H2Client::request_builder("localhost", "POST", "upload_chunk", Some(param)).unwrap();
|
||||||
let upload_data = Some(chunk_info.data.freeze());
|
let upload_data = Some(chunk_info.data.freeze());
|
||||||
|
|
||||||
let new_info = MergedChunkInfo::Known(vec![(chunk_info.offset, chunk_info.digest)]);
|
let new_info = MergedChunkInfo::Known(vec![(chunk_info.offset, chunk_info.digest)]);
|
||||||
|
Loading…
Reference in New Issue
Block a user