Page MenuHomePhabricator

[SQLite] implement processing keyserver store ops on worker
ClosedPublic

Authored by kamil on Jan 22 2024, 5:32 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Dec 23, 6:57 PM
Unknown Object (File)
Mon, Dec 23, 6:57 PM
Unknown Object (File)
Mon, Dec 23, 6:57 PM
Unknown Object (File)
Mon, Dec 23, 6:57 PM
Unknown Object (File)
Mon, Dec 23, 6:57 PM
Unknown Object (File)
Fri, Dec 20, 9:09 PM
Unknown Object (File)
Fri, Dec 6, 8:29 AM
Unknown Object (File)
Thu, Dec 5, 6:35 AM
Subscribers

Details

Summary

Code for web worker

Depends on D10780

Test Plan

Call this code:

const databaseModule = await getDatabaseModule();

let data = await databaseModule.schedule({
  type: workerRequestMessageTypes.GET_CLIENT_STORE,
});
console.log(data.store.keyservers);

await databaseModule.schedule({
  type: workerRequestMessageTypes.PROCESS_STORE_OPERATIONS,
  storeOperations: {
    keyserverStoreOperations: [
      {
        type: 'replace_keyserver',
        payload: {
          id: '1',
          keyserverInfo: 'fdfd',
        },
      },
      {
        type: 'replace_keyserver',
        payload: {
          id: '2',
          keyserverInfo: 'fdfd',
        },
      },
    ],
  },
});

data = await databaseModule.schedule({
  type: workerRequestMessageTypes.GET_CLIENT_STORE,
});
console.log(data.store.keyservers);

await databaseModule.schedule({
  type: workerRequestMessageTypes.PROCESS_STORE_OPERATIONS,
  storeOperations: {
    keyserverStoreOperations: [
      {
        type: 'replace_keyserver',
        payload: {
          id: '2',
          keyserverInfo: 'fdfd45454545',
        },
      },
    ],
  },
});

data = await databaseModule.schedule({
  type: workerRequestMessageTypes.GET_CLIENT_STORE,
});
console.log(data.store.keyservers);

await databaseModule.schedule({
  type: workerRequestMessageTypes.PROCESS_STORE_OPERATIONS,
  storeOperations: {
    keyserverStoreOperations: [
      {
        type: 'remove_keyservers',
        payload: {
          ids: ['1'],
        },
      },
    ],
  },
});

data = await databaseModule.schedule({
  type: workerRequestMessageTypes.GET_CLIENT_STORE,
});
console.log(data.store.keyservers);

await databaseModule.schedule({
  type: workerRequestMessageTypes.PROCESS_STORE_OPERATIONS,
  storeOperations: {
    keyserverStoreOperations: [
      {
        type: 'remove_all_keyservers',
      },
    ],
  },
});

data = await databaseModule.schedule({
  type: workerRequestMessageTypes.GET_CLIENT_STORE,
});
console.log(data.store.keyservers);

Diff Detail

Repository
rCOMM Comm
Branch
fix-persistence
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

kamil held this revision as a draft.
kamil published this revision for review.Jan 22 2024, 6:41 AM
This revision is now accepted and ready to land.Jan 22 2024, 9:56 AM