1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2025 ReifyDB
//! Canonical on-disk and on-wire byte layouts for every primitive value the database stores or transmits.
//!
//! There is one submodule per primitive kind: signed and unsigned integers from 8 to 128 bits, IEEE floats, booleans,
//! variable-length blobs and UTF-8 strings, decimals, the temporal family (date, datetime, time, duration), the UUID
//! variants, identity and dictionary references, the arbitrary-precision integer wrappers, the typed-row and shape
//! envelopes, the typed-key encoding, the `any`-tagged variant for heterogeneous columns, and the `undefined` sentinel.
//! Each submodule supplies the encode and decode routines that take a typed value to the bytes that go to disk,
//! replication, CDC, and the wire protocol, and back again.
//!
//! Invariant: once a primitive's byte layout has shipped, it is the format used by storage, replication, CDC, and the
//! wire protocol simultaneously. Any change is a coordinated cross-format break that requires a migration; consumers
//! must continue to round-trip every previously-written byte sequence forever.