Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3401433
D11420.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
D11420.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,7 +39,10 @@
ClientDBReport,
ClientDBReportStoreOperation,
} from '../ops/report-store-ops.js';
-import type { ClientDBSyncedMetadataEntry } from '../ops/synced-metadata-store-ops.js';
+import type {
+ ClientDBSyncedMetadataEntry,
+ ClientDBSyncedMetadataStoreOperation,
+} from '../ops/synced-metadata-store-ops.js';
import type {
ClientDBThreadStoreOperation,
ThreadStoreOperation,
@@ -68,6 +71,7 @@
+keyserverStoreOperations?: $ReadOnlyArray<ClientDBKeyserverStoreOperation>,
+communityStoreOperations?: $ReadOnlyArray<ClientDBCommunityStoreOperation>,
+integrityStoreOperations?: $ReadOnlyArray<ClientDBIntegrityStoreOperation>,
+ +syncedMetadataStoreOperations?: $ReadOnlyArray<ClientDBSyncedMetadataStoreOperation>,
};
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
@@ -4,6 +4,7 @@
import type { ClientDBIntegrityStoreOperation } from 'lib/ops/integrity-store-ops.js';
import type { ClientDBKeyserverStoreOperation } from 'lib/ops/keyserver-store-ops.js';
import type { ClientDBReportStoreOperation } from 'lib/ops/report-store-ops.js';
+import type { ClientDBSyncedMetadataStoreOperation } from 'lib/ops/synced-metadata-store-ops.js';
import type { ClientDBThreadStoreOperation } from 'lib/ops/thread-store-ops.js';
import type {
ClientDBDraftStoreOperation,
@@ -218,6 +219,37 @@
}
}
+function processSyncedMetadataStoreOperations(
+ sqliteQueryExecutor: SQLiteQueryExecutor,
+ operations: $ReadOnlyArray<ClientDBSyncedMetadataStoreOperation>,
+ module: EmscriptenModule,
+) {
+ for (const operation: ClientDBSyncedMetadataStoreOperation of operations) {
+ try {
+ if (operation.type === 'remove_all_synced_metadata') {
+ sqliteQueryExecutor.removeAllSyncedMetadata();
+ } else if (operation.type === 'remove_synced_metadata') {
+ const { names } = operation.payload;
+ sqliteQueryExecutor.removeSyncedMetadata(names);
+ } else if (operation.type === 'replace_synced_metadata_entry') {
+ const { name, data } = operation.payload;
+ sqliteQueryExecutor.replaceSyncedMetadataEntry({ name, data });
+ } else {
+ throw new Error('Unsupported synced metadata operation');
+ }
+ } catch (e) {
+ throw new Error(
+ `Error while processing ${
+ operation.type
+ } synced metadata operation: ${getProcessingStoreOpsExceptionMessage(
+ e,
+ module,
+ )}`,
+ );
+ }
+ }
+}
+
function processDBStoreOperations(
sqliteQueryExecutor: SQLiteQueryExecutor,
storeOperations: ClientDBStoreOperations,
@@ -230,6 +262,7 @@
keyserverStoreOperations,
communityStoreOperations,
integrityStoreOperations,
+ syncedMetadataStoreOperations,
} = storeOperations;
try {
@@ -276,6 +309,16 @@
module,
);
}
+ if (
+ syncedMetadataStoreOperations &&
+ syncedMetadataStoreOperations.length > 0
+ ) {
+ processSyncedMetadataStoreOperations(
+ sqliteQueryExecutor,
+ syncedMetadataStoreOperations,
+ module,
+ );
+ }
sqliteQueryExecutor.commitTransaction();
} catch (e) {
sqliteQueryExecutor.rollbackTransaction();
@@ -299,7 +342,7 @@
keyservers: sqliteQueryExecutor.getAllKeyservers(),
communities: sqliteQueryExecutor.getAllCommunities(),
integrityThreadHashes: sqliteQueryExecutor.getAllIntegrityThreadHashes(),
- syncedMetadata: [],
+ syncedMetadata: sqliteQueryExecutor.getAllSyncedMetadata(),
};
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 3, 12:05 PM (21 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2611619
Default Alt Text
D11420.diff (3 KB)
Attached To
Mode
D11420: [sqlite] implement processing synced metadata store ops on worker
Attached
Detach File
Event Timeline
Log In to Comment