MCPcopy Create free account
hub / github.com/experdot/pointer / getPageFileQueue

Function getPageFileQueue

src/renderer/src/stores/persistenceQueue.ts:301–329  ·  view source on GitHub ↗
(scope: WorkspaceScope)

Source from the content-addressed store, hash-verified

299}
300
301function getPageFileQueue(scope: WorkspaceScope): PersistenceQueue<string, PageFileMutation> {
302 return getOrCreateQueue(workspaceQueueId(scope, 'page-file'), () =>
303 createPersistenceQueue<string, PageFileMutation>(
304 async (pageId, mutation) => {
305 if (mutation.deletePage) {
306 await persistence.workspace(scope).pages.deleteWithMessages(pageId)
307 return
308 }
309
310 if (mutation.page) {
311 await flushQueue(getFoldersQueue(scope))
312 await persistence.workspace(scope).pages.put(mutation.page)
313 }
314
315 if (mutation.messages !== undefined) {
316 if (mutation.messages === null) {
317 await persistence.workspace(scope).messages.delete(pageId)
318 } else {
319 await persistence.workspace(scope).messages.put(pageId, mutation.messages)
320 }
321 }
322 },
323 {
324 ...DEFAULT_QUEUE_OPTIONS,
325 mergePending: mergePageFileMutation
326 }
327 )
328 )
329}
330
331export function queueFoldersSnapshot(scope: WorkspaceScope, folders: PageFolder[]): void {
332 getFoldersQueue(scope).enqueue('folders', folders)

Callers 4

queuePagePutFunction · 0.85
queuePageDeleteFunction · 0.85
queueMessagesPutFunction · 0.85
queueMessagesDeleteFunction · 0.85

Calls 9

getOrCreateQueueFunction · 0.85
workspaceQueueIdFunction · 0.85
createPersistenceQueueFunction · 0.85
flushQueueFunction · 0.85
getFoldersQueueFunction · 0.85
deleteWithMessagesMethod · 0.80
workspaceMethod · 0.65
putMethod · 0.65
deleteMethod · 0.65

Tested by

no test coverage detected