Specification
Currently the DB uses JSON encoding by default for storing structured data.
This encoding is lossy. Not all of JS types can be represented using JSON, and in other cases it can be quite fat when encoding binary data.
Sometimes we want to store structured data that may include binary data and other useful things like Dates.
Remember things like undefined gets turned into null when in arrays, so that can be surprising.
Consider checking out CBOR (which seems an evolution from message pack and BSON).
Additional context
Tasks
- Compare the encoding of bufffers, typed arrays, dates, and
undefined
- Compare the performance with JSON encoding
- Ensure that we get roundtrip isomorphism, what goes in, is what comes out, for random JS objects
- Ensure that CBOR supports additional JS "data types", and ultimately produces an
ArrayBuffer that is accepted by the NAPI into rocksdb.
Specification
Currently the DB uses JSON encoding by default for storing structured data.
This encoding is lossy. Not all of JS types can be represented using JSON, and in other cases it can be quite fat when encoding binary data.
Sometimes we want to store structured data that may include binary data and other useful things like Dates.
Remember things like
undefinedgets turned intonullwhen in arrays, so that can be surprising.Consider checking out CBOR (which seems an evolution from message pack and BSON).
Additional context
Tasks
undefinedArrayBufferthat is accepted by the NAPI into rocksdb.