Page MenuHomePhabricator

D4166.id13353.diff
No OneTemporary

D4166.id13353.diff

diff --git a/services/commtest/src/send_log.rs b/services/commtest/src/send_log.rs
new file mode 100644
--- /dev/null
+++ b/services/commtest/src/send_log.rs
@@ -0,0 +1,42 @@
+use crate::backup_utils::{
+ proto::send_log_request::Data::*, proto::SendLogRequest, BackupServiceClient,
+};
+
+use tonic::Request;
+
+pub async fn run(
+ client: &mut BackupServiceClient<tonic::transport::Channel>,
+ user_id: &String,
+ backup_id: &String,
+) -> Result<String, Box<dyn std::error::Error>> {
+ println!("send log");
+ let cloned_user_id = user_id.clone();
+ let cloned_backup_id = backup_id.clone();
+ let outbound = async_stream::stream! {
+ println!(" - sending user id");
+ let request = SendLogRequest {
+ data: Some(UserId(cloned_user_id)),
+ };
+ yield request;
+ println!(" - sending backup id");
+ let request = SendLogRequest {
+ data: Some(BackupId(cloned_backup_id)),
+ };
+ yield request;
+ println!(" - sending log hash");
+ let request = SendLogRequest {
+ data: Some(LogHash(vec![65,66,67,68])),
+ };
+ yield request;
+ println!(" - sending log data");
+ let request = SendLogRequest {
+ data: Some(LogData(vec![68,67,66,65])),
+ };
+ yield request;
+ };
+
+ let response = client.send_log(Request::new(outbound)).await?;
+ let inbound = response.into_inner();
+ println!("send log response: {:?}", inbound.log_checkpoint);
+ Ok(inbound.log_checkpoint)
+}

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 18, 12:37 PM (21 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2534936
Default Alt Text
D4166.id13353.diff (1 KB)

Event Timeline