MCPcopy Create free account
hub / github.com/CommE2E/comm / processThreadStoreOperations

Function processThreadStoreOperations

web/shared-worker/worker/process-operations.js:107–137  ·  view source on GitHub ↗
(
  sqliteQueryExecutor: SQLiteQueryExecutorWrapper,
  operations: $ReadOnlyArray<ClientDBThreadStoreOperation>,
  module: EmscriptenModule,
)

Source from the content-addressed store, hash-verified

105}
106
107function processThreadStoreOperations(
108 sqliteQueryExecutor: SQLiteQueryExecutorWrapper,
109 operations: $ReadOnlyArray<ClientDBThreadStoreOperation>,
110 module: EmscriptenModule,
111) {
112 for (const operation: ClientDBThreadStoreOperation of operations) {
113 try {
114 if (operation.type === 'remove_all') {
115 sqliteQueryExecutor.removeAllThreads();
116 } else if (operation.type === 'remove') {
117 const { ids } = operation.payload;
118 sqliteQueryExecutor.removeThreads(ids);
119 } else if (operation.type === 'replace') {
120 sqliteQueryExecutor.replaceThread(
121 clientDBThreadInfoToWebThread(operation.payload),
122 operation.isBackedUp,
123 );
124 } else {
125 throw new Error('Unsupported thread operation');
126 }
127 } catch (e) {
128 throw new Error(
129 `Error while processing ${
130 operation.type
131 } thread operation: ${getProcessingStoreOpsExceptionMessage(
132 e,
133 module,
134 )}`,
135 );
136 }
137 }
138}
139
140function processKeyserverStoreOperations(

Callers 4

handleFullStateSyncFunction · 0.85
reduceThreadInfosFunction · 0.85
processDBStoreOperationsFunction · 0.85

Calls 5

removeAllThreadsMethod · 0.45
removeThreadsMethod · 0.45
replaceThreadMethod · 0.45

Tested by

no test coverage detected