Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3536023
D4867.id15780.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D4867.id15780.diff
View Options
diff --git a/services/backup/rust_lib/src/lib.rs b/services/backup/rust_lib/src/lib.rs
--- a/services/backup/rust_lib/src/lib.rs
+++ b/services/backup/rust_lib/src/lib.rs
@@ -8,6 +8,9 @@
}
}
+mod constants;
+
+use constants::MPSC_CHANNEL_BUFFER_CAPACITY;
use tokio::runtime::Runtime;
use tokio::sync::mpsc;
use tokio::task::JoinHandle;
@@ -40,7 +43,20 @@
}
pub fn rust_initialize_cxx() -> () {
- unimplemented!();
+ println!("[RUST] initializing");
+ assert!(!rust_is_initialized_cxx(), "client cannot be initialized twice");
+ let (tx, mut rx): (mpsc::Sender<String>, mpsc::Receiver<String>) =
+ mpsc::channel(MPSC_CHANNEL_BUFFER_CAPACITY);
+ let handle = RUNTIME.spawn(async move {
+ println!("[RUST] [receiver] begin");
+ while let Some(data) = rx.recv().await {
+ println!("[RUST] [receiver] data: {}", data);
+ }
+ println!("[RUST] [receiver] done");
+ });
+ CLIENT.lock().expect("access client").handle = Some(handle);
+ CLIENT.lock().expect("access client").tx = Some(tx);
+ println!("[RUST] initialized");
}
pub fn rust_process_cxx(_: *const c_char) -> () {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 26, 5:21 PM (12 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2707705
Default Alt Text
D4867.id15780.diff (1 KB)
Attached To
Mode
D4867: [services] Backup - Rust lib - Add initialize
Attached
Detach File
Event Timeline
Log In to Comment