HomePhabricator
Diffusion Comm bcd0dd5b01b7

[backup-client] Uploading logs

Description

[backup-client] Uploading logs

Summary:
ENG-5557 : Add support for uploading logs from backup clients

This diff adds an option to create a websocket connection, upload logs and receive upload confirmations from the backup service. The stream/sink from tungstenite is mapped so that the clients only deal with business logic. The reconnection etc. will be handled in the outside code.

Depends on D10457

Test Plan:
Tested with next diffs from commtest and native mobile devices. Tested with this code:

let (tx, rx) = backup_client
  .upload_logs(&user_identity, &backup_data.backup_id)
  .await
  .unwrap();

tokio::pin!(tx);
tokio::pin!(rx);

for log_data in log_datas {
  tx.send(log_data.clone()).await.unwrap();
}

let result: HashSet<usize> =
  rx.take(log_datas.len()).try_collect().await.unwrap();
let expected = log_datas.iter().map(|data| data.log_id).collect();
assert_eq!(result, expected);

Reviewers: bartek, kamil

Reviewed By: bartek

Subscribers: ashoat, tomek

Differential Revision: https://phab.comm.dev/D10532

Details

Provenance
Michal Gniadek <michal.gniadek@swmansion.com>Authored on Jan 4 2024, 7:17 AM
Reviewer
bartek
Differential Revision
D10532: [backup-client] Uploading logs
Parents
rCOMMdf7964047d75: [backup] Log download endpoint
Branches
Unknown
Tags
Unknown

Event Timeline

Michal Gniadek <michal.gniadek@swmansion.com> committed rCOMMbcd0dd5b01b7: [backup-client] Uploading logs (authored by Michal Gniadek <michal.gniadek@swmansion.com>).Jan 8 2024, 7:20 AM