persistence: CarrierStore + LoadPortStore enable_persistence(dir)

Mirrors SpoolStore: per-record file with atomic .tmp+rename, magic+
version-prefixed binary layout, replay on enable, delete on remove.
FSMs gain a restore_state() that bypasses the transition table and
handlers since a replay isn't a transition.

Six new tests cover write+restart+replay across every CIDS/CSMS/CAS
axis, remove-deletes-journal, malformed-record drop-not-poison, and
the persistence-disabled no-op path.

Closes #1 in the test-gap backlog.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-09 10:25:50 +02:00
parent 29f646c7ca
commit f56639ba17
5 changed files with 571 additions and 43 deletions
+8
View File
@@ -104,6 +104,14 @@ class LoadPortStateMachine {
bool on_reservation_event(LoadPortReservationEvent e);
bool on_association_event(LoadPortAssociationEvent e);
// Direct state-restore (persistence replay only). See carrier_state.hpp.
void restore_state(LoadPortTransferState tx, LoadPortReservationStatus rs,
LoadPortAssociationStatus as) {
tx_state_ = tx;
rs_state_ = rs;
as_state_ = as;
}
private:
LoadPortTransferTable tx_table_;
LoadPortReservationTable rs_table_;