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
99
100
101
102
103
104
105
106
107
108
// Copyright (C) 2026 Industrial Algebra
// SPDX-License-Identifier: AGPL-3.0-only
//! Optical backend for holographic memory with checkpoint-based persistence.
//!
//! This module provides an optical computing backend built on `amari-holographic`'s
//! optical primitives. Key features:
//!
//! - **Hardware abstraction**: `OpticalHardware` trait for DMD/MMF systems
//! - **Checkpoint persistence**: Journal-based state persistence that's portable across hardware
//! - **T-matrix fingerprinting**: Fast hardware state validation without full calibration
//! - **Symbolic expressions**: Hardware-independent memory content representation
//!
//! # Architecture
//!
//! ```text
//! ┌─────────────────────────────────────────────────────────────────────┐
//! │ Application Layer │
//! ├─────────────────────────────────────────────────────────────────────┤
//! │ │
//! │ ┌───────────────────────────────────────────────────────────────┐ │
//! │ │ CheckpointedOpticalMemory │ │
//! │ │ • store() / retrieve() - optical hot paths │ │
//! │ │ • checkpoint() - periodic persistence │ │
//! │ │ • restore() - hardware-independent recovery │ │
//! │ └───────────────────────────────────────────────────────────────┘ │
//! │ │ │
//! │ ┌───────────────────┼───────────────────┐ │
//! │ ▼ ▼ ▼ │
//! │ ┌─────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
//! │ │MemoryJournal│ │TMatrixFingerprint│ │OpticalHardware │ │
//! │ │ (portable) │ │ (validation) │ │ (backend) │ │
//! │ └─────────────┘ └─────────────────┘ └─────────────────┘ │
//! │ │
//! └─────────────────────────────────────────────────────────────────────┘
//! ```
//!
//! # Persistence Model
//!
//! The optical system is a **compute accelerator**, not a storage medium.
//! Minuet persists the logical state and regenerates hardware-specific state on restore:
//!
//! | Layer | Content | Portability |
//! |-------|---------|-------------|
//! | Semantic | Associations, relationships | Fully portable |
//! | Codebook | Symbol → seed mappings | Regenerable |
//! | Holograms | Binary patterns | Derived on demand |
//! | Calibration | T-matrix, learned patterns | Hardware-bound |
//!
//! # Example
//!
//! ```ignore
//! use minuet::optical::*;
//!
//! // Create memory with mock hardware
//! let hardware = MockOpticalHardware::new(42);
//! let mut memory = CheckpointedOpticalMemory::new(
//! hardware,
//! LeeEncoderConfig::default(),
//! CodebookConfig::default(),
//! CheckpointConfig::default(),
//! )?;
//!
//! // Store associations
//! memory.store(
//! SymbolicExpression::role_filler("AGENT", "John"),
//! SymbolicExpression::role_filler("ACTION", "run"),
//! )?;
//!
//! // Checkpoint (saves to journal)
//! memory.checkpoint()?;
//!
//! // Later, restore on same or different hardware
//! let new_hardware = MockOpticalHardware::new(42);
//! let restored = CheckpointedOpticalMemory::restore(new_hardware, config)?;
//! ```
pub use ;
pub use ;
pub use ;
pub use ;
pub use MockOpticalHardware;
pub use ;
/// Current time as u64 milliseconds since Unix epoch.
///
/// # Panics
///
/// Panics if the system time is before the Unix epoch (January 1, 1970).