Skip to content

Change from JSON encoding to using CBOR/BSON encoding #58

Open
@CMCDragonkai

Description

@CMCDragonkai

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

  1. Compare the encoding of bufffers, typed arrays, dates, and undefined
  2. Compare the performance with JSON encoding
  3. Ensure that we get roundtrip isomorphism, what goes in, is what comes out, for random JS objects
  4. Ensure that CBOR supports additional JS "data types", and ultimately produces an ArrayBuffer that is accepted by the NAPI into rocksdb.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions