Page MenuHomePhabricator

[services] Backup - Use Blob client in c++ - Implement pull backup
ClosedPublic

Authored by karol on Sep 1 2022, 4:10 AM.
Tags
None
Referenced Files
F2101018: D5020.id.diff
Mon, Jun 24, 9:36 PM
F2099866: D5020.id16180.diff
Mon, Jun 24, 5:41 PM
F2098569: D5020.id16479.diff
Mon, Jun 24, 3:01 PM
Unknown Object (File)
Fri, Jun 21, 3:33 AM
Unknown Object (File)
Tue, Jun 18, 9:03 PM
Unknown Object (File)
Wed, Jun 12, 11:30 PM
Unknown Object (File)
Tue, Jun 4, 6:51 PM
Unknown Object (File)
Sun, May 26, 8:15 PM

Details

Summary

Depends on D5019

Adding c++ implementation for using the blob client in the backup reactor for pulling backups.

Test Plan

backup builds

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

services/backup/src/Reactors/server/PullBackupReactor.cpp
69 ↗(On Diff #16180)

isn't this supposed to return a Result? How are we assigning it directly to the Ok() case?

tomek requested changes to this revision.Sep 5 2022, 7:21 AM
tomek added inline comments.
services/backup/src/Reactors/server/PullBackupReactor.cpp
69–73 ↗(On Diff #16180)

Is this correct way of performing this conversion? We have a Vec<unsigned char> which contains a sequence of bytes and we create a string from it. Are we using string as a sequence of bytes or chars here? If we want to use it as a sequence of bytes, maybe it would be less confusing to use e.g. std::vector<uint8_t> or uint8_t[]. If we want actual chars, then we should convert it somehow because they were probably encoded in UTF8 on Rust's side.

This revision now requires changes to proceed.Sep 5 2022, 7:21 AM
karol added inline comments.
services/backup/src/Reactors/server/PullBackupReactor.cpp
69 ↗(On Diff #16180)

Rust's Result is translated into c++ so if it returns Ok, c++ gets the value and if it returns Err, c++ throws std::exception

69–73 ↗(On Diff #16180)

I remember we've had this discussion before and in general, it's okay to store "any bytes" in std::string. We do this in a lot of places in the code so I'm not sure why we wouldn't do it the same way here.

69–73 ↗(On Diff #16180)
tomek added 1 blocking reviewer(s): jon.
tomek added inline comments.
services/backup/src/Reactors/server/PullBackupReactor.cpp
69–73 ↗(On Diff #16180)

What's the advantage of string over vector<unsigned char>? For me using string hides the intention of storing binary data, so I think it would be better if we don't do that. We can keep it for now, though.

Side note is that the logic of transforming rust::Vec into string is repeated in a couple of places, so it is a good idea to have a function that would do that.

This revision is now accepted and ready to land.Sep 7 2022, 11:18 AM
services/backup/src/Reactors/server/PullBackupReactor.cpp
69–73 ↗(On Diff #16180)

I don't think this is a really good place to discuss this. You can create a task for this- as I said, this is used all over the place.

This revision was landed with ongoing or failed builds.Sep 8 2022, 4:10 AM
This revision was automatically updated to reflect the committed changes.