Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3390773
D11511.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D11511.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
@@ -16,7 +16,10 @@
import type { SyncedMetadata } from './synced-metadata-types.js';
import type { ClientDBThreadInfo, ThreadStore } from './thread-types.js';
import type { UserInfos } from './user-types.js';
-import type { ClientDBAuxUserInfo } from '../ops/aux-user-store-ops.js';
+import type {
+ ClientDBAuxUserInfo,
+ ClientDBAuxUserStoreOperation,
+} from '../ops/aux-user-store-ops.js';
import type {
ClientDBCommunityInfo,
ClientDBCommunityStoreOperation,
@@ -75,6 +78,7 @@
+communityStoreOperations?: $ReadOnlyArray<ClientDBCommunityStoreOperation>,
+integrityStoreOperations?: $ReadOnlyArray<ClientDBIntegrityStoreOperation>,
+syncedMetadataStoreOperations?: $ReadOnlyArray<ClientDBSyncedMetadataStoreOperation>,
+ +auxUserStoreOperations?: $ReadOnlyArray<ClientDBAuxUserStoreOperation>,
};
export type ClientDBStore = {
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
@@ -1,5 +1,6 @@
// @flow
+import type { ClientDBAuxUserStoreOperation } from 'lib/ops/aux-user-store-ops.js';
import type { ClientDBCommunityStoreOperation } from 'lib/ops/community-store-ops.js';
import type { ClientDBIntegrityStoreOperation } from 'lib/ops/integrity-store-ops.js';
import type { ClientDBKeyserverStoreOperation } from 'lib/ops/keyserver-store-ops.js';
@@ -267,6 +268,7 @@
communityStoreOperations,
integrityStoreOperations,
syncedMetadataStoreOperations,
+ auxUserStoreOperations,
} = storeOperations;
try {
@@ -323,6 +325,13 @@
module,
);
}
+ if (auxUserStoreOperations && auxUserStoreOperations.length > 0) {
+ processAuxUserStoreOperations(
+ sqliteQueryExecutor,
+ auxUserStoreOperations,
+ module,
+ );
+ }
sqliteQueryExecutor.commitTransaction();
} catch (e) {
sqliteQueryExecutor.rollbackTransaction();
@@ -331,6 +340,37 @@
}
}
+function processAuxUserStoreOperations(
+ sqliteQueryExecutor: SQLiteQueryExecutor,
+ operations: $ReadOnlyArray<ClientDBAuxUserStoreOperation>,
+ module: EmscriptenModule,
+) {
+ for (const operation: ClientDBAuxUserStoreOperation of operations) {
+ try {
+ if (operation.type === 'remove_all_aux_user_infos') {
+ sqliteQueryExecutor.removeAllAuxUserInfos();
+ } else if (operation.type === 'remove_aux_user_infos') {
+ const { ids } = operation.payload;
+ sqliteQueryExecutor.removeAuxUserInfos(ids);
+ } else if (operation.type === 'replace_aux_user_info') {
+ const { id, auxUserInfo } = operation.payload;
+ sqliteQueryExecutor.replaceAuxUserInfo({ id, auxUserInfo });
+ } else {
+ throw new Error('Unsupported aux user operation');
+ }
+ } catch (e) {
+ throw new Error(
+ `Error while processing ${
+ operation.type
+ } aux user operation: ${getProcessingStoreOpsExceptionMessage(
+ e,
+ module,
+ )}`,
+ );
+ }
+ }
+}
+
function getClientStoreFromQueryExecutor(
sqliteQueryExecutor: SQLiteQueryExecutor,
): ClientDBStore {
@@ -347,7 +387,7 @@
communities: sqliteQueryExecutor.getAllCommunities(),
integrityThreadHashes: sqliteQueryExecutor.getAllIntegrityThreadHashes(),
syncedMetadata: sqliteQueryExecutor.getAllSyncedMetadata(),
- auxUserInfos: [],
+ auxUserInfos: sqliteQueryExecutor.getAllAuxUserInfos(),
};
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 1, 12:59 AM (5 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2603072
Default Alt Text
D11511.diff (3 KB)
Attached To
Mode
D11511: [sqlite] implement processing aux user store ops on worker
Attached
Detach File
Event Timeline
Log In to Comment