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/// CanisterKind
28/// Marker for canister namespaces
29///
30
31pub trait CanisterKind: Path + 'static {
32 /// Stable memory slot used for commit marker storage.
33 const COMMIT_MEMORY_ID: u8;
34
35 /// Durable stable-memory allocation key for commit marker storage.
36 const COMMIT_STABLE_KEY: &'static str;
37
38 /// Stable memory slot used only for integrity-inspection progress.
39 const INTEGRITY_PROGRESS_MEMORY_ID: u8;
40
41 /// Durable stable-memory allocation key for integrity-inspection progress.
42 const INTEGRITY_PROGRESS_STABLE_KEY: &'static str;
43}
44
45///
46/// Repr
47///
48/// Internal representation boundary for scalar wrapper types.
49///
50
51pub trait Repr {
52 type Inner;
53
54 fn repr(&self) -> Self::Inner;
55 fn from_repr(inner: Self::Inner) -> Self;
56}