kora-doc 0.2.0

JSON document database with secondary indexes and WHERE queries for Kōra
Documentation
  • Coverage
  • 100%
    335 out of 335 items documented0 out of 165 items with examples
  • Size
  • Source code size: 223.78 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 19.03 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 32s Average build duration of successful builds.
  • all releases: 32s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Augani/Kora
    6 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Augani

kora-doc

Document layer that turns Kora from a key-value cache engine into a JSON-native document database. Documents are stored in a compact binary packed format, queried via a WHERE expression parser, and indexed through four secondary index types (hash, sorted, array, unique).

Architecture

A JSON document passes through a pipeline of transformations before it reaches storage:

  1. Decomposition ([decompose]) -- a JSON object is recursively walked, each leaf field is assigned a numeric FieldId via the IdRegistry, string values are dictionary-encoded when their field cardinality is low, and the result is assembled into a PackedDoc.

  2. Packed encoding ([packed]) -- fields are stored in a flat binary buffer with an offset table sorted by field ID, enabling O(log F) single-field reads via binary search.

  3. Recomposition ([recompose]) -- the inverse of decomposition, rebuilding a serde_json::Value from packed bytes, dictionary lookups, and registry path resolution. Supports full reconstruction or field-level projection.

Key Modules

Module Purpose
[packed] Binary packed document format and builder
[registry] Integer-keyed ID mapping for collections, fields, and docs
[dictionary] Dictionary encoding for low-cardinality string values
[decompose] JSON to packed document conversion
[recompose] Packed document to JSON reconstruction
[engine] Collection CRUD, index maintenance, and query execution
[expr] WHERE clause recursive-descent parser
[index] Hash, sorted, array, and unique secondary indexes
[collection] Collection metadata and configuration
[key] Binary key encoding for storage and index records