Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3401659
D10509.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
8 KB
Referenced Files
None
Subscribers
None
D10509.diff
View Options
diff --git a/native/android/app/CMakeLists.txt b/native/android/app/CMakeLists.txt
--- a/native/android/app/CMakeLists.txt
+++ b/native/android/app/CMakeLists.txt
@@ -201,6 +201,7 @@
../../cpp/CommonCpp/NativeModules
../../cpp/CommonCpp/NativeModules/InternalModules
../../cpp/CommonCpp/NativeModules/PersistentStorageUtilities
+ ../../cpp/CommonCpp/NativeModules/PersistentStorageUtilities/BackupOperationsUtilities
../../cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores
../../cpp/CommonCpp/NativeModules/PersistentStorageUtilities/ThreadOperationsUtilities
../../cpp/CommonCpp/NativeModules/PersistentStorageUtilities/MessageOperationsUtilities
diff --git a/native/cpp/CommonCpp/NativeModules/CMakeLists.txt b/native/cpp/CommonCpp/NativeModules/CMakeLists.txt
--- a/native/cpp/CommonCpp/NativeModules/CMakeLists.txt
+++ b/native/cpp/CommonCpp/NativeModules/CMakeLists.txt
@@ -88,6 +88,14 @@
${_data_stores_path}/UserStore.cpp
)
+set(_backup_op_path ./PersistentStorageUtilities/BackupOperationsUtilities)
+set(BACKUP_OP_HDRS
+ ${_backup_op_path}/BackupOperationsExecutor.h
+)
+set(BACKUP_OP_SRCS
+ ${_backup_op_path}/BackupOperationsExecutor.cpp
+)
+
add_library(comm-modules-persistentstorage
${MESSAGE_HDRS}
${MESSAGE_SRCS}
@@ -96,6 +104,8 @@
${THREAD_OP_SRCS}
${DATA_STORES_HDRS}
${DATA_STORES_SRCS}
+ ${BACKUP_OP_HDRS}
+ ${BACKUP_OP_SRCS}
)
# reference local directory when building, use installation path when installing
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/BackupOperationsUtilities/BackupOperationsExecutor.h b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/BackupOperationsUtilities/BackupOperationsExecutor.h
new file mode 100644
--- /dev/null
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/BackupOperationsUtilities/BackupOperationsExecutor.h
@@ -0,0 +1,13 @@
+#pragma once
+
+#include <string>
+
+namespace comm {
+class BackupOperationsExecutor {
+public:
+ static void createMainCompaction(std::string backupID);
+ static void restoreFromMainCompaction(
+ std::string mainCompactionPath,
+ std::string mainCompactionEncryptionKey);
+};
+} // namespace comm
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/BackupOperationsUtilities/BackupOperationsExecutor.cpp b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/BackupOperationsUtilities/BackupOperationsExecutor.cpp
new file mode 100644
--- /dev/null
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/BackupOperationsUtilities/BackupOperationsExecutor.cpp
@@ -0,0 +1,39 @@
+#include "BackupOperationsExecutor.h"
+#include "DatabaseManager.h"
+#include "GlobalDBSingleton.h"
+#include "Logger.h"
+#include "WorkerThread.h"
+
+namespace comm {
+void BackupOperationsExecutor::createMainCompaction(std::string backupID) {
+ taskType job = [backupID]() {
+ try {
+ DatabaseManager::getQueryExecutor().createMainCompaction(backupID);
+ } catch (const std::exception &e) {
+ // TODO: Inform Rust networking about main
+ // compaction creation failure
+ Logger::log(
+ "Main compaction creation failed. Details: " + std::string(e.what()));
+ }
+ };
+ GlobalDBSingleton::instance.scheduleOrRunCancellable(job);
+}
+
+void BackupOperationsExecutor::restoreFromMainCompaction(
+ std::string mainCompactionPath,
+ std::string mainCompactionEncryptionKey) {
+ taskType job = [mainCompactionPath, mainCompactionEncryptionKey]() {
+ try {
+ DatabaseManager::getQueryExecutor().restoreFromMainCompaction(
+ mainCompactionPath, mainCompactionEncryptionKey);
+ } catch (const std::exception &e) {
+ // TODO: Inform Rust networking about failure
+ // of restoration from main compaction.
+ Logger::log(
+ "Restore from main compaction failed. Details: " +
+ std::string(e.what()));
+ }
+ };
+ GlobalDBSingleton::instance.scheduleOrRunCancellable(job);
+}
+} // namespace comm
diff --git a/native/ios/Comm.xcodeproj/project.pbxproj b/native/ios/Comm.xcodeproj/project.pbxproj
--- a/native/ios/Comm.xcodeproj/project.pbxproj
+++ b/native/ios/Comm.xcodeproj/project.pbxproj
@@ -78,6 +78,7 @@
CB7EF17E295C674300B17035 /* CommIOSNotifications.mm in Sources */ = {isa = PBXBuildFile; fileRef = CB7EF17D295C5D1800B17035 /* CommIOSNotifications.mm */; };
CB7EF180295C674300B17035 /* CommIOSNotificationsBridgeQueue.mm in Sources */ = {isa = PBXBuildFile; fileRef = CB7EF17B295C580500B17035 /* CommIOSNotificationsBridgeQueue.mm */; };
CB90951F29534B32002F2A7F /* CommSecureStore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 71D4D7CB26C50B1000FCDBCD /* CommSecureStore.mm */; };
+ CBAAA4702B459181007599DA /* BackupOperationsExecutor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CBAAA46E2B459181007599DA /* BackupOperationsExecutor.cpp */; };
CBCA09062A8E0E7400F75B3E /* StaffUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CBCA09052A8E0E6B00F75B3E /* StaffUtils.cpp */; };
CBCA09072A8E0E7D00F75B3E /* StaffUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CBCA09052A8E0E6B00F75B3E /* StaffUtils.cpp */; };
CBDEC69B28ED867000C17588 /* GlobalDBSingleton.mm in Sources */ = {isa = PBXBuildFile; fileRef = CBDEC69A28ED867000C17588 /* GlobalDBSingleton.mm */; };
@@ -273,6 +274,8 @@
CB7EF17D295C5D1800B17035 /* CommIOSNotifications.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = CommIOSNotifications.mm; path = Comm/CommIOSNotifications/CommIOSNotifications.mm; sourceTree = "<group>"; };
CB90951929531663002F2A7F /* CommIOSNotifications.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommIOSNotifications.h; path = Comm/CommIOSNotifications/CommIOSNotifications.h; sourceTree = "<group>"; };
CBA784382B28AC4300E9F419 /* CommServicesAuthMetadataEmitter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CommServicesAuthMetadataEmitter.h; sourceTree = "<group>"; };
+ CBAAA46E2B459181007599DA /* BackupOperationsExecutor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BackupOperationsExecutor.cpp; path = PersistentStorageUtilities/BackupOperationsUtilities/BackupOperationsExecutor.cpp; sourceTree = "<group>"; };
+ CBAAA46F2B459181007599DA /* BackupOperationsExecutor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BackupOperationsExecutor.h; path = PersistentStorageUtilities/BackupOperationsUtilities/BackupOperationsExecutor.h; sourceTree = "<group>"; };
CBCA09042A8E0E6B00F75B3E /* StaffUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StaffUtils.h; sourceTree = "<group>"; };
CBCA09052A8E0E6B00F75B3E /* StaffUtils.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = StaffUtils.cpp; sourceTree = "<group>"; };
CBCF57AB2B05096F00EC4BC0 /* AESCryptoModuleObjCCompat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AESCryptoModuleObjCCompat.h; path = Comm/CommAESCryptoUtils/AESCryptoModuleObjCCompat.h; sourceTree = "<group>"; };
@@ -716,6 +719,15 @@
name = CommIOSNotifications;
sourceTree = "<group>";
};
+ CBAAA46D2B45915F007599DA /* BackupOperationsUtilities */ = {
+ isa = PBXGroup;
+ children = (
+ CBAAA46E2B459181007599DA /* BackupOperationsExecutor.cpp */,
+ CBAAA46F2B459181007599DA /* BackupOperationsExecutor.h */,
+ );
+ name = BackupOperationsUtilities;
+ sourceTree = "<group>";
+ };
CBCF57A92B05091D00EC4BC0 /* CommAESCryptoUtils */ = {
isa = PBXGroup;
children = (
@@ -727,6 +739,7 @@
CBED0E2C284E086100CD3863 /* PersistentStorageUtilities */ = {
isa = PBXGroup;
children = (
+ CBAAA46D2B45915F007599DA /* BackupOperationsUtilities */,
8EA59BD02A6E786200EB4F53 /* DataStores */,
CBFE582628858512003B94C9 /* ThreadOperationsUtilities */,
CB38F2AC286C6C010010535C /* MessageOperationsUtilities */,
@@ -1083,6 +1096,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ CBAAA4702B459181007599DA /* BackupOperationsExecutor.cpp in Sources */,
CBCA09062A8E0E7400F75B3E /* StaffUtils.cpp in Sources */,
8EF7756B2A7433630046A385 /* ThreadStore.cpp in Sources */,
CB2689002A2DF58000EC7300 /* CommConstants.cpp in Sources */,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 3, 1:15 PM (5 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2611794
Default Alt Text
D10509.diff (8 KB)
Attached To
Mode
D10509: Implement C++ file to expose backup API
Attached
Detach File
Event Timeline
Log In to Comment