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
F3544161: D10781.id35957.diff
Thu, Dec 26, 12:00 PM
F3544015: D10781.id36566.diff
Thu, Dec 26, 11:51 AM
F3538624: D10781.diff
Wed, Dec 25, 11:12 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)
Mon, Dec 23, 6:57 PM
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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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