You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1.5 KiB

coders

Every coder has two different encoding modes, though they may share the same implementation:

  1. Index key mode, which produces a binary-sortable representation for usage in index building
  2. Value mode, which produces a reversible representation for actual data storage

Both modes should result in a Buffer and optionally an auxiliary blob (for out-of-band blob storage).

Index key mode

Technical priorities and requirements:

  • Must be binary-sortable; that is, upon sorting a list of encoded representations, its order must match that of the original corresponding inputs if those were to be lexicographically sorted (according to the sorting rules for their data type).
  • Must be deterministic; the same input value must result in the same encoded representation every time. If there is a controllable form of non-determinism (eg. a versioned set of sorting rules such as DUCET), it must be possible to regenerate the index keys for all existing values with the new version of the encoding.
  • Must be space-efficient.
  • Prioritize encoding speed over other (non-required) characteristics such as reversibility.

Value mode

Technical priorities and requirements:

  • Must be reversible; ie. it must be possible to losslessly decode the encoded representation back into its original value.
  • Must be space-efficient.
  • Prioritize decoding speed over encoding speed (within reasonable bounds) as well as other (non-required) characteristics such as binary-sortability.