Page MenuHomePhabricator

[sqlite] implement C++ synced metadata store ops
ClosedPublic

Authored by will on Mar 27 2024, 3:26 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 12, 12:59 AM
Unknown Object (File)
Tue, Apr 9, 12:27 PM
Unknown Object (File)
Sat, Apr 6, 8:45 AM
Unknown Object (File)
Fri, Apr 5, 1:50 AM
Unknown Object (File)
Wed, Apr 3, 10:37 PM
Unknown Object (File)
Wed, Apr 3, 1:32 AM
Unknown Object (File)
Wed, Apr 3, 1:32 AM
Unknown Object (File)
Tue, Apr 2, 10:38 AM
Subscribers

Details

Summary

Introduces code allowing native to use sqlite synced metadata store ops

Depends on D11417

Test Plan

Ran the following code:

async function run_test() {
  console.log('running run_test()');

  await commCoreModule.processSyncedMetadataStoreOperations([
    {
      type: 'remove_all_synced_metadata',
    },
  ]);

  let data = await commCoreModule.getClientDBStore();
  console.log(data.syncedMetadata);

  await commCoreModule.processSyncedMetadataStoreOperations([
    {
      type: 'replace_synced_metadata_entry',
      payload: {
        name: 'test_B_name',
        data: 'test_B_data',
      },
    },
    {
      type: 'replace_synced_metadata_entry',
      payload: {
        name: 'test_A_name',
        data: 'test_A_data',
      },
    },
    {
      type: 'replace_synced_metadata_entry',
      payload: {
        name: 'test_A_name',
        data: 'test_A_update',
      },
    },
    {
      type: 'remove_synced_metadata',
      payload: { names: ['test_B_name'] },
    },
  ]);

  data = await commCoreModule.getClientDBStore();
  console.log(data.syncedMetadata);
}

And received the correct response of [{"data": "test_A_update", "name": "test_A_name"}]

Screenshot 2024-03-27 at 6.22.06 PM.png (768×846 px, 139 KB)

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

will edited the test plan for this revision. (Show Details)
will requested review of this revision.Mar 27 2024, 3:41 PM
native/cpp/CommonCpp/NativeModules/SyncedMetadataStoreOperations.h
7 ↗(On Diff #38399)

Nit: maybe add a newline here

This revision is now accepted and ready to land.Mar 28 2024, 4:51 AM