Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3492099
D4166.id13396.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
D4166.id13396.diff
View Options
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,49 @@
+use crate::backup_utils::{
+ proto::send_log_request::Data::*, proto::SendLogRequest, BackupServiceClient,
+};
+
+use tonic::Request;
+
+use crate::tools::generate_nbytes;
+use crate::backup_utils::BackupData;
+
+pub async fn run(
+ client: &mut BackupServiceClient<tonic::transport::Channel>,
+ backup_data: &BackupData,
+ log_index: usize
+) -> Result<String, Box<dyn std::error::Error>> {
+ println!("send log");
+ let cloned_user_id = backup_data.user_id.clone();
+ let cloned_backup_id = backup_data.backup_id.clone();
+ let cloned_log_sizes = backup_data.logs_sizes[log_index].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,66+(log_index as u8)])),
+ };
+ yield request;
+ println!(" - sending log data");
+ for log_size in cloned_log_sizes {
+ println!(" - sending log data {}", log_size);
+ let request = SendLogRequest {
+ data: Some(LogData(generate_nbytes(log_size, None))),
+ };
+ 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
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 19, 10:10 PM (21 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2678999
Default Alt Text
D4166.id13396.diff (1 KB)
Attached To
Mode
D4166: [services] Tests - Add send log
Attached
Detach File
Event Timeline
Log In to Comment