MockDataStoreService icon indicating copy to clipboard operation
MockDataStoreService copied to clipboard

Implement DataStores v2

Open nomer888 opened this issue 3 years ago • 1 comments

This PR implements DataStores v2 APIs. Resolves #22 Some tests are disabled in this branch as they were failing when I forked.

Changes:

  • Implemented metadata API to MockDataStoreService:GetAsync and MockDataStoreService:SetAsync with corresponding tests
  • Added hack to Utils.importPairsFromTable to inject metadata
  • Added hack to MockDataStoreService:ExportToJSON to inject metadata

nomer888 avatar Mar 12 '22 00:03 nomer888

I'm currently stuck on finding a good way to make this change compatible with JSON exporting/importing. Currently I'm injecting metadata to exported JSON as the __metadata key under __data, and removing it on import if it's present. I'm not sure there's a non-breaking way to introduce this.

Maybe it'd be better to return a tuple from ExportToJSON; encodedData, encodedMetadata? There's also the question of how versioning from v2 fits into this which I'm not sure how to answer yet.

nomer888 avatar Mar 12 '22 00:03 nomer888