HomePhabricator
Diffusion Comm 9c42fe342b5e

[SQLite] implement processing keyserver store ops on worker

Description

[SQLite] implement processing keyserver store ops on worker

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);

Reviewers: inka

Reviewed By: inka

Subscribers: ashoat, tomek

Differential Revision: https://phab.comm.dev/D10781

Details

Provenance
kamilAuthored on Jan 20 2024, 4:52 PM
Reviewer
inka
Differential Revision
D10781: [SQLite] implement processing keyserver store ops on worker
Parents
rCOMMe4972363514f: [web] update `getClientStore` name
Branches
Unknown
Tags
Unknown