Page MenuHomePhabricator

D5089.diff
No OneTemporary

D5089.diff

diff --git a/services/backup/blob_client/Cargo.lock b/services/backup/blob_client/Cargo.lock
--- a/services/backup/blob_client/Cargo.lock
+++ b/services/backup/blob_client/Cargo.lock
@@ -13,9 +13,9 @@
[[package]]
name = "anyhow"
-version = "1.0.62"
+version = "1.0.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1485d4d2cc45e7b201ee3767015c96faa5904387c9d87c6efdd0fb511f12d305"
+checksum = "b9a8f622bcf6ff3df478e9deba3e03e4e04b300f8e6a139e192c05fa3490afc7"
[[package]]
name = "async-stream"
@@ -114,6 +114,7 @@
name = "blob_client"
version = "0.1.0"
dependencies = [
+ "anyhow",
"async-stream",
"cxx",
"cxx-build",
diff --git a/services/backup/blob_client/Cargo.toml b/services/backup/blob_client/Cargo.toml
--- a/services/backup/blob_client/Cargo.toml
+++ b/services/backup/blob_client/Cargo.toml
@@ -13,6 +13,7 @@
prost = "0.11"
tracing = "0.1"
async-stream = "0.3"
+anyhow = "1.0"
[build-dependencies]
cxx-build = "1.0"
diff --git a/services/backup/blob_client/src/tools.rs b/services/backup/blob_client/src/tools.rs
--- a/services/backup/blob_client/src/tools.rs
+++ b/services/backup/blob_client/src/tools.rs
@@ -41,6 +41,13 @@
}
}
+pub fn c_char_pointer_to_string_new(
+ c_char_pointer: *const c_char,
+) -> anyhow::Result<String, anyhow::Error> {
+ let holder_cstr: &CStr = unsafe { CStr::from_ptr(c_char_pointer) };
+ Ok(holder_cstr.to_str()?.to_owned())
+}
+
pub fn string_to_c_char_pointer(
signs: &String,
) -> Result<*const c_char, String> {
@@ -50,3 +57,9 @@
Err(err) => Err(err.to_string()),
}
}
+
+pub fn string_to_c_char_pointer_new(
+ signs: &String,
+) -> anyhow::Result<*const c_char, anyhow::Error> {
+ Ok(CString::new((&signs).as_bytes())?.as_ptr())
+}

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 23, 12:22 AM (17 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2566830
Default Alt Text
D5089.diff (1 KB)

Event Timeline