Skip to main content

Crate hidane_core

Crate hidane_core 

Source
Expand description

The Firestore data model as hidane implements it.

  • bson: the BSON types of an enterprise database (min and max keys, object IDs, regular expressions, 32-bit integers, 128-bit decimals, BSON timestamps, binary data).
  • order: how Firestore orders values (orderBy, cursors, range filters) and document names (__name__).
  • key: an order-preserving byte encoding of the same order, for storage keys and indexes: compare(a, b) == encode(a).cmp(&encode(b)) for every pair of values.
  • path: document and collection paths; field_path: field paths and mask operations.
  • store: the storage boundary and the in-memory engine (versioned documents, snapshot reads, commits that report what changed).
  • transform: field transforms (server timestamps, increments, array unions, …).
  • normalize: what Firestore does to a value when it is written (timestamps lose their sub-microsecond digits).
  • export: the official emulator’s export format (LevelDB logs of App Engine entities).

Every rule here was checked against the official emulator v1.22.0; the observations live in tests/fixtures/value_order.json and are regenerated with tools/oracle/value_order.py.

Modules§

bson
The BSON types of an enterprise database (#338), as the SDKs write them: maps of one reserved key. {__min__: null} and {__max__: null} sort before and after every other value; {__oid__: "<24 hex digits>"} is an object ID; {__regex__: {pattern, options}} a regular expression; {__int__: <integer>} a 32-bit integer and {__decimal128__: "<decimal>"} a 128-bit decimal, both numbers; {__request_timestamp__: {seconds, increment}} a BSON timestamp; {__binary__: <subtype byte, then the data>} bytes with a subtype (tests/fixtures/bson_types.json).
export
The official emulator’s export format (Cloud Datastore’s managed export), byte for byte.
field_path
Field paths (a.b, `x.y`.z) and the operations masks need on document fields.
hash_order
The iteration order of a Java HashMap<String, _>.
key
Order-preserving byte encoding of values and document names.
normalize
What Firestore does to values when it stores them.
order
Firestore value ordering.
path
Document and collection paths, relative to projects/{p}/databases/{d}/documents.
store
The storage boundary (ADR 0002).
transform
Field transforms (serverTimestamp, increment, maximum, minimum, arrayUnion, arrayRemove).