Page MenuHomePhabricator

[services][backup] PullBackup 2/5 - handler core logic
ClosedPublic

Authored by bartek on Jan 11 2023, 3:17 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 28, 4:29 AM
Unknown Object (File)
Thu, Nov 28, 4:29 AM
Unknown Object (File)
Thu, Nov 28, 4:28 AM
Unknown Object (File)
Thu, Nov 28, 4:28 AM
Unknown Object (File)
Thu, Nov 28, 4:28 AM
Unknown Object (File)
Thu, Nov 21, 2:00 AM
Unknown Object (File)
Nov 5 2024, 4:48 PM
Unknown Object (File)
Nov 5 2024, 4:48 PM
Subscribers

Details

Summary

Added main logic for pulling backup. In the first step backup and logs are fetched from database. Then they're streamed to client in the following order:

  • All backup data chunks
  • All logs. For each log:
    • All log chunks (if stored in blob)
    • The whole log at once (if stored in db)

Depends on D6240

Test Plan

This is tested altogether with other diffs for this endpoint

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bartek held this revision as a draft.
bartek published this revision for review.Jan 11 2023, 3:55 PM

otherwise LGTM, I'll defer to tomek

services/backup/src/service/handlers/pull_backup.rs
32 ↗(On Diff #20923)

if find_log_items_for_backup took AsRef<str> as a parameter, then we wouldn't need to explicity do as_str()

services/backup/src/service/handlers/pull_backup.rs
32 ↗(On Diff #20923)

Good catch, but in this case find_log_items_for_backup(&backup_item.backup_id) would work too - I don't remember why I used as_ref();

The find_log_items_for_backup looks like this:

fn find_log_items_for_backup(
    backup_id: &str,
) {
  let some_str: String = backup_id.to_string()
  // ...

In my opinion, in this case it'd be better to use Into<String> instead of AsRef:

fn find_log_items_for_backup(
    backup_id: impl Into<String>,
) {
  let some_str: String = backup_id.into()
  // ...

This should work for both slices and owned strings

I can create a starter task for this (find_log_items_for_backup is already landed)

This revision is now accepted and ready to land.Jan 19 2023, 8:32 AM
services/backup/src/service/handlers/pull_backup.rs
32 ↗(On Diff #20923)