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, Nov 9, 6:53 AM
Unknown Object (File)
Fri, Nov 8, 10:39 AM
Unknown Object (File)
Fri, Nov 8, 8:44 AM
Unknown Object (File)
Thu, Nov 7, 4:32 PM
Unknown Object (File)
Thu, Nov 7, 11:28 AM
Unknown Object (File)
Thu, Nov 7, 8:17 AM
Unknown Object (File)
Thu, Nov 7, 4:32 AM
Unknown Object (File)
Thu, Nov 7, 2:19 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?