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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
//! KEL storage port traits for reading and writing Key Event Logs.
//!
//! These traits are pure KERI abstractions — they operate on serialized event
//! bytes identified by KERI prefixes. They have no dependency on any specific
//! storage backend (git2, SQL, etc.) and compile for WASM targets.
use cratePrefix;
/// Domain error type for KEL storage operations.
///
/// Variants mirror `auths_core::ports::storage::StorageError` so that
/// a `From<KelStorageError> for StorageError` impl can bridge between layers.
///
/// Usage:
/// ```ignore
/// use auths_keri::kel_io::KelStorageError;
///
/// fn handle(err: KelStorageError) {
/// match err {
/// KelStorageError::NotFound { path } => eprintln!("missing: {path}"),
/// KelStorageError::AlreadyExists { path } => eprintln!("duplicate: {path}"),
/// KelStorageError::CasConflict => eprintln!("concurrent modification"),
/// KelStorageError::Io(msg) => eprintln!("I/O: {msg}"),
/// KelStorageError::Internal(inner) => eprintln!("bug: {inner}"),
/// }
/// }
/// ```
/// Reads serialized key event log (KEL) entries for a KERI prefix.
///
/// Implementations provide access to the ordered event history without
/// exposing how or where events are stored.
///
/// Usage:
/// ```ignore
/// use auths_keri::kel_io::EventLogReader;
/// use auths_keri::Prefix;
///
/// fn latest_event(reader: &dyn EventLogReader, prefix: &Prefix) -> Vec<u8> {
/// reader.read_event_log(prefix).unwrap()
/// }
/// ```
/// Appends serialized key events to a KERI prefix's event log.
///
/// Implementations handle the mechanics of persisting a new event
/// (e.g., writing a Git commit, inserting a database row) while the
/// domain only provides the serialized event bytes.
///
/// Usage:
/// ```ignore
/// use auths_keri::kel_io::EventLogWriter;
/// use auths_keri::Prefix;
///
/// fn record_inception(writer: &dyn EventLogWriter, prefix: &Prefix, event: &[u8]) {
/// writer.append_event(prefix, event).unwrap();
/// }
/// ```