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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
//! Module: db::schema::storage
//! Responsibility: accepted field persistence and write-policy vocabulary.
//! Does not own: authored/generated field descriptors or physical row encoding.
//! Boundary: accepted schema snapshots select these contracts; data/runtime
//! consumers execute them.
///
/// FieldStorageDecode
///
/// Accepted persisted-field payload interpretation.
///
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub(in crate::db) enum FieldStorageDecode {
/// Decode the persisted payload according to its accepted field kind.
ByKind,
/// Decode the canonical recursive value envelope, then apply its accepted
/// catalog contract.
CatalogValue,
}
///
/// ScalarCodec
///
/// Canonical binary leaf encoding selected by accepted schema.
///
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub(in crate::db) enum ScalarCodec {
Blob,
Bool,
Date,
Duration,
Float32,
Float64,
Int64,
Principal,
Subaccount,
Text,
Timestamp,
Nat64,
Ulid,
Unit,
}
///
/// LeafCodec
///
/// Accepted row-slot codec class.
///
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub(in crate::db) enum LeafCodec {
/// Dedicated scalar codec selected by the accepted field kind.
Scalar(ScalarCodec),
/// Recursive structural field codec.
Structural,
}
///
/// CompositeCodec
///
/// Canonical persisted grammar for an accepted composite type.
///
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub(in crate::db) enum CompositeCodec {
/// Current structural record, tuple, and newtype encoding.
StructuralV1,
}
///
/// FieldInsertGeneration
///
/// Accepted insert-time field generation contract.
///
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub(in crate::db) enum FieldInsertGeneration {
/// Generate a fresh ULID.
Ulid,
/// Generate the operation timestamp.
Timestamp,
}
///
/// FieldWriteManagement
///
/// Accepted database-owned audit-field policy.
///
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub(in crate::db) enum FieldWriteManagement {
/// Fill only when the row is inserted.
CreatedAt,
/// Fill on insert and refresh on every update.
UpdatedAt,
}