Page MenuHomePhabricator

D5011.diff
No OneTemporary

D5011.diff

diff --git a/services/backup/blob_client/src/put_client.rs b/services/backup/blob_client/src/put_client.rs
--- a/services/backup/blob_client/src/put_client.rs
+++ b/services/backup/blob_client/src/put_client.rs
@@ -210,7 +210,36 @@
field_index: usize,
data: *const c_char,
) -> Result<(), String> {
- unimplemented!();
+ check_error()?;
+ let data_c_str: &CStr = unsafe { CStr::from_ptr(data) };
+ let data_bytes: Vec<u8> = data_c_str.to_bytes().to_vec();
+
+ RUNTIME.block_on(async {
+ if let Ok(mut maybe_client) = CLIENT.lock() {
+ if let Some(client) = (*maybe_client).take() {
+ match client
+ .tx
+ .send(PutRequestData {
+ field_index,
+ data: data_bytes,
+ })
+ .await
+ {
+ Ok(_) => (),
+ Err(err) => {
+ report_error(format!("send data to receiver failed: {}", err))
+ }
+ }
+ *maybe_client = Some(client);
+ } else {
+ report_error("no client detected".to_string());
+ }
+ } else {
+ report_error("couldn't access client".to_string());
+ }
+ });
+ check_error()?;
+ Ok(())
}
pub fn put_client_terminate_cxx() -> Result<(), String> {

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 29, 12:57 PM (20 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2597060
Default Alt Text
D5011.diff (1 KB)

Event Timeline