Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3707159
D11307.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
D11307.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
@@ -19,6 +19,7 @@
ClientDBCommunityStoreOperation,
CommunityStoreOperation,
} from '../ops/community-store-ops.js';
+import type { ClientDBIntegrityThreadHash } from '../ops/integrity-store-ops.js';
import type {
ClientDBKeyserverInfo,
ClientDBKeyserverStoreOperation,
@@ -70,6 +71,7 @@
+users: $ReadOnlyArray<ClientDBUserInfo>,
+keyservers: $ReadOnlyArray<ClientDBKeyserverInfo>,
+communities: $ReadOnlyArray<ClientDBCommunityInfo>,
+ +integrityThreadHashes: $ReadOnlyArray<ClientDBIntegrityThreadHash>,
};
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
@@ -119,6 +119,7 @@
std::vector<UserInfo> userStoreVector;
std::vector<KeyserverInfo> keyserverStoreVector;
std::vector<CommunityInfo> communityStoreVector;
+ std::vector<IntegrityThreadHash> integrityStoreVector;
try {
draftsVector = DatabaseManager::getQueryExecutor().getAllDrafts();
messagesVector =
@@ -133,6 +134,8 @@
DatabaseManager::getQueryExecutor().getAllKeyservers();
communityStoreVector =
DatabaseManager::getQueryExecutor().getAllCommunities();
+ integrityStoreVector = DatabaseManager::getQueryExecutor()
+ .getAllIntegrityThreadHashes();
} catch (std::system_error &e) {
error = e.what();
}
@@ -156,6 +159,9 @@
auto communityStoreVectorPtr =
std::make_shared<std::vector<CommunityInfo>>(
std::move(communityStoreVector));
+ auto integrityStoreVectorPtr =
+ std::make_shared<std::vector<IntegrityThreadHash>>(
+ std::move(integrityStoreVector));
this->jsInvoker_->invokeAsync([&innerRt,
draftsVectorPtr,
messagesVectorPtr,
@@ -165,6 +171,7 @@
userStoreVectorPtr,
keyserveStoreVectorPtr,
communityStoreVectorPtr,
+ integrityStoreVectorPtr,
error,
promise,
draftStore = this->draftStore,
@@ -173,8 +180,9 @@
reportStore = this->reportStore,
userStore = this->userStore,
keyserverStore = this->keyserverStore,
- communityStore =
- this->communityStore]() {
+ communityStore = this->communityStore,
+ integrityStore =
+ this->integrityStore]() {
if (error.size()) {
promise->reject(error);
return;
@@ -196,6 +204,8 @@
innerRt, keyserveStoreVectorPtr);
jsi::Array jsiCommunityStore = communityStore.parseDBDataStore(
innerRt, communityStoreVectorPtr);
+ jsi::Array jsiIntegrityStore = integrityStore.parseDBDataStore(
+ innerRt, integrityStoreVectorPtr);
auto jsiClientDBStore = jsi::Object(innerRt);
jsiClientDBStore.setProperty(innerRt, "messages", jsiMessages);
@@ -209,6 +219,8 @@
innerRt, "keyservers", jsiKeyserverStore);
jsiClientDBStore.setProperty(
innerRt, "communities", jsiCommunityStore);
+ jsiClientDBStore.setProperty(
+ innerRt, "integrityThreadHashes", jsiIntegrityStore);
promise->resolve(std::move(jsiClientDBStore));
});
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/IntegrityStore.cpp b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/IntegrityStore.cpp
--- a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/IntegrityStore.cpp
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/DataStores/IntegrityStore.cpp
@@ -22,7 +22,19 @@
jsi::Runtime &rt,
std::shared_ptr<std::vector<IntegrityThreadHash>>
integrityThreadHashesVectorPtr) const {
- jsi::Array jsiIntegrityThreadHashes = jsi::Array(rt, 0);
+ size_t numIntegrityThreadHashes = integrityThreadHashesVectorPtr->size();
+ jsi::Array jsiIntegrityThreadHashes =
+ jsi::Array(rt, numIntegrityThreadHashes);
+ size_t writeIdx = 0;
+ for (const IntegrityThreadHash &integrityThreadHash :
+ *integrityThreadHashesVectorPtr) {
+ jsi::Object jsiIntegrityThreadHash = jsi::Object(rt);
+ jsiIntegrityThreadHash.setProperty(rt, "id", integrityThreadHash.id);
+ jsiIntegrityThreadHash.setProperty(
+ rt, "threadHash", integrityThreadHash.thread_hash);
+ jsiIntegrityThreadHashes.setValueAtIndex(
+ rt, writeIdx++, jsiIntegrityThreadHash);
+ }
return jsiIntegrityThreadHashes;
}
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
@@ -258,6 +258,7 @@
users: [],
keyservers: sqliteQueryExecutor.getAllKeyservers(),
communities: sqliteQueryExecutor.getAllCommunities(),
+ integrityThreadHashes: [],
};
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jan 9, 1:15 AM (1 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2813201
Default Alt Text
D11307.diff (5 KB)
Attached To
Mode
D11307: [sqlite] Implement C++ code to get integrity store thread hashes
Attached
Detach File
Event Timeline
Log In to Comment