Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3398986
D11419.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D11419.diff
View Options
diff --git a/lib/types/store-ops-types.js b/lib/types/store-ops-types.js
--- a/lib/types/store-ops-types.js
+++ b/lib/types/store-ops-types.js
@@ -39,6 +39,7 @@
ClientDBReport,
ClientDBReportStoreOperation,
} from '../ops/report-store-ops.js';
+import type { ClientDBSyncedMetadataEntry } from '../ops/synced-metadata-store-ops.js';
import type {
ClientDBThreadStoreOperation,
ThreadStoreOperation,
@@ -79,6 +80,7 @@
+keyservers: $ReadOnlyArray<ClientDBKeyserverInfo>,
+communities: $ReadOnlyArray<ClientDBCommunityInfo>,
+integrityThreadHashes: $ReadOnlyArray<ClientDBIntegrityThreadHash>,
+ +syncedMetadata: $ReadOnlyArray<ClientDBSyncedMetadataEntry>,
};
export type ClientStore = {
diff --git a/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp b/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
--- a/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
+++ b/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
@@ -120,6 +120,7 @@
std::vector<KeyserverInfo> keyserverStoreVector;
std::vector<CommunityInfo> communityStoreVector;
std::vector<IntegrityThreadHash> integrityStoreVector;
+ std::vector<SyncedMetadataEntry> syncedMetadataStoreVector;
try {
draftsVector = DatabaseManager::getQueryExecutor().getAllDrafts();
messagesVector =
@@ -136,6 +137,9 @@
DatabaseManager::getQueryExecutor().getAllCommunities();
integrityStoreVector = DatabaseManager::getQueryExecutor()
.getAllIntegrityThreadHashes();
+ syncedMetadataStoreVector =
+ DatabaseManager::getQueryExecutor().getAllSyncedMetadata();
+
} catch (std::system_error &e) {
error = e.what();
}
@@ -162,6 +166,9 @@
auto integrityStoreVectorPtr =
std::make_shared<std::vector<IntegrityThreadHash>>(
std::move(integrityStoreVector));
+ auto syncedMetadataStoreVectorPtr =
+ std::make_shared<std::vector<SyncedMetadataEntry>>(
+ std::move(syncedMetadataStoreVector));
this->jsInvoker_->invokeAsync([&innerRt,
draftsVectorPtr,
messagesVectorPtr,
@@ -172,6 +179,7 @@
keyserveStoreVectorPtr,
communityStoreVectorPtr,
integrityStoreVectorPtr,
+ syncedMetadataStoreVectorPtr,
error,
promise,
draftStore = this->draftStore,
@@ -181,8 +189,9 @@
userStore = this->userStore,
keyserverStore = this->keyserverStore,
communityStore = this->communityStore,
- integrityStore =
- this->integrityStore]() {
+ integrityStore = this->integrityStore,
+ syncedMetadataStore =
+ this->syncedMetadataStore]() {
if (error.size()) {
promise->reject(error);
return;
@@ -206,6 +215,9 @@
innerRt, communityStoreVectorPtr);
jsi::Array jsiIntegrityStore = integrityStore.parseDBDataStore(
innerRt, integrityStoreVectorPtr);
+ jsi::Array jsiSyncedMetadataStore =
+ syncedMetadataStore.parseDBDataStore(
+ innerRt, syncedMetadataStoreVectorPtr);
auto jsiClientDBStore = jsi::Object(innerRt);
jsiClientDBStore.setProperty(innerRt, "messages", jsiMessages);
@@ -221,6 +233,8 @@
innerRt, "communities", jsiCommunityStore);
jsiClientDBStore.setProperty(
innerRt, "integrityThreadHashes", jsiIntegrityStore);
+ jsiClientDBStore.setProperty(
+ innerRt, "syncedMetadata", jsiSyncedMetadataStore);
promise->resolve(std::move(jsiClientDBStore));
});
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/SyncedMetadataStore.cpp b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/SyncedMetadataStore.cpp
--- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/SyncedMetadataStore.cpp
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/SyncedMetadataStore.cpp
@@ -20,7 +20,16 @@
jsi::Runtime &rt,
std::shared_ptr<std::vector<SyncedMetadataEntry>> syncedMetadataVectorPtr)
const {
- jsi::Array jsiSyncedMetadata = jsi::Array(rt, 0);
+ size_t numSyncedMetadata = syncedMetadataVectorPtr->size();
+ jsi::Array jsiSyncedMetadata = jsi::Array(rt, numSyncedMetadata);
+ size_t writeIdx = 0;
+ for (const SyncedMetadataEntry &syncedMetadataEntry :
+ *syncedMetadataVectorPtr) {
+ jsi::Object jsiSyncedMetadataEntry = jsi::Object(rt);
+ jsiSyncedMetadataEntry.setProperty(rt, "name", syncedMetadataEntry.name);
+ jsiSyncedMetadataEntry.setProperty(rt, "data", syncedMetadataEntry.data);
+ jsiSyncedMetadata.setValueAtIndex(rt, writeIdx++, jsiSyncedMetadataEntry);
+ }
return jsiSyncedMetadata;
}
diff --git a/web/shared-worker/worker/process-operations.js b/web/shared-worker/worker/process-operations.js
--- a/web/shared-worker/worker/process-operations.js
+++ b/web/shared-worker/worker/process-operations.js
@@ -299,6 +299,7 @@
keyservers: sqliteQueryExecutor.getAllKeyservers(),
communities: sqliteQueryExecutor.getAllCommunities(),
integrityThreadHashes: sqliteQueryExecutor.getAllIntegrityThreadHashes(),
+ syncedMetadata: [],
};
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 3, 1:19 AM (11 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2609626
Default Alt Text
D11419.diff (5 KB)
Attached To
Mode
D11419: [sqlite] implement C++ code to get synced metadata
Attached
Detach File
Event Timeline
Log In to Comment