icydb_core/traits/mod.rs
1//! Module: traits
2//!
3//! Responsibility: foundational kind, field metadata, and projection
4//! contracts awaiting narrower domain ownership.
5//! Does not own: entity composition, key taxonomy, runtime value conversion,
6//! visitor traversal, executor policy, or public facade DTO behavior.
7//! Boundary: remaining reusable contracts consumed throughout `icydb-core`.
8
9// ============================================================================
10// FOUNDATIONAL KINDS
11// ============================================================================
12//
13// These traits define *where* something lives in the system,
14// not what data it contains.
15//
16
17///
18/// Path
19/// Fully-qualified schema path.
20///
21
22pub trait Path {
23 const PATH: &'static str;
24}
25
26///
27/// Kind
28/// Marker for all schema/runtime nodes.
29///
30
31pub trait Kind: Path + 'static {}
32impl<T> Kind for T where T: Path + 'static {}
33
34///
35/// CanisterKind
36/// Marker for canister namespaces
37///
38
39pub trait CanisterKind: Kind {
40 /// Stable memory slot used for commit marker storage.
41 const COMMIT_MEMORY_ID: u8;
42
43 /// Durable stable-memory allocation key for commit marker storage.
44 const COMMIT_STABLE_KEY: &'static str;
45
46 /// Stable memory slot used only for integrity-inspection progress.
47 const INTEGRITY_PROGRESS_MEMORY_ID: u8;
48
49 /// Durable stable-memory allocation key for integrity-inspection progress.
50 const INTEGRITY_PROGRESS_STABLE_KEY: &'static str;
51}
52
53///
54/// StoreKind
55/// Marker for data stores bound to a canister
56///
57
58pub trait StoreKind: Kind {
59 type Canister: CanisterKind;
60}
61
62///
63/// Repr
64///
65/// Internal representation boundary for scalar wrapper types.
66///
67
68pub trait Repr {
69 type Inner;
70
71 fn repr(&self) -> Self::Inner;
72 fn from_repr(inner: Self::Inner) -> Self;
73}