Page MenuHomePhabricator

[native] Create and upload backup compaction
ClosedPublic

Authored by michal on Jan 29 2024, 2:42 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jun 29, 6:57 AM
Unknown Object (File)
Thu, Jun 27, 8:33 PM
Unknown Object (File)
Wed, Jun 26, 5:57 AM
Unknown Object (File)
Mon, Jun 24, 12:38 PM
Unknown Object (File)
Sun, Jun 23, 2:46 PM
Unknown Object (File)
Sun, Jun 23, 5:21 AM
Unknown Object (File)
Fri, Jun 21, 3:14 PM
Unknown Object (File)
Fri, Jun 14, 1:27 AM
Subscribers

Details

Summary

Update the JS and Rust code to upload sqlite backup compaction. First Rust saves the encrypted user keys data to a file and schedules a C++ code the to also save the database compaction. After both of these are done it uploads them to the backup service. If all operations succeed the JS promise is resolved otherwise it's rejected.

Depends on D10858

Test Plan

Click the test button in JS, make sure the backup is uploaded to the backup service and files are removed. [with later diffs] tested that the backup can be restored. Tested that errors are propageated to the JS promise.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.Jan 30 2024, 9:13 AM

Simplified the codeflow a bit after changes to the previous diff.

kamil added inline comments.
native/native_rust_library/src/backup.rs
47 ↗(On Diff #36787)

hmm... this looks confusing to not have reject() method, but I assume there was a good reason to do it that way

47 ↗(On Diff #36787)

actually I think I should ask about it in D10858

native/native_rust_library/src/constants.rs
3 ↗(On Diff #36787)

do we need it?

native/profile/backup-menu.react.js
37 ↗(On Diff #36787)

Match capitalization

Fix naming

native/native_rust_library/src/backup.rs
47 ↗(On Diff #36787)

I did it this way, because it simplifies the code in the future compaction_upload_promises and removed some code duplication. While it's not the way it works in JS I don't think it's that confusing and it doesn't introduce any footguns.

native/native_rust_library/src/constants.rs
3 ↗(On Diff #36787)

We stopped using KEY_SIZE in this diff.

native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp
26 ↗(On Diff #37326)

Nit – is there intentionally an extra slash at the start of this line?