The library is in a good place now to consider alternative forms of backing storage. One candidate is a binary storage format.
PR #11 added separate Reader and Writer classes which means we could, for example, receive an update in JSON format but write it to storage in a binary format. And vice-versa.
Advantages
Disadvantages
- More difficult to accommodate schema changes
One caveat with writing is that the string pool may contain unused items which we don't want to save to storage.
Strings are referenced by their offset in the string pool, so we could add a Compact function to remove unused items and update all StringId references. With #12 we can guarantee there are no other users of the store instance, so this is fine.
Reading a store is probably fairly straightforward since I'd expect storage to reflect the arrangement of the internal rootData, stringPool and arrayPool elements.
The library is in a good place now to consider alternative forms of backing storage. One candidate is a binary storage format.
PR #11 added separate
ReaderandWriterclasses which means we could, for example, receive an update in JSON format but write it to storage in a binary format. And vice-versa.Advantages
Disadvantages
One caveat with writing is that the string pool may contain unused items which we don't want to save to storage.
Strings are referenced by their offset in the string pool, so we could add a
Compactfunction to remove unused items and update all StringId references. With #12 we can guarantee there are no other users of the store instance, so this is fine.Reading a store is probably fairly straightforward since I'd expect storage to reflect the arrangement of the internal
rootData,stringPoolandarrayPoolelements.