Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions payjoin/src/core/persist.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
//! State machine persistence for payjoin sessions.
//!
//! The receiver and senders' v1 and v2 state machines are driven by events. An
//! event contains all the information to transition into the next state, which
//! means that the session's full state can be computed by "replaying" the events.
//! Session history is therefore a recorded as an append only log of events.
//!
//! # Backwards and forwards compatibility
//!
//! If any new fields are added to events, backwards compatibility must be
//! maintained, which means that new fields are necessarily `Option<T>`
//! defaulting to `None`, allowing old event data to be still be processed.
//! Forward compatibility in general is not appropriate since old state machines
//! will not know the meaning of the new fields, and ignoring them may lead to a
//! transition to an invalid state, inconsistent with the state machine of any
//! later version of the code that persisted this event data.
//!
//! If any new event types are added, presumably extending the state machine
//! with additional transitions and states, the same logic applies: old sessions
//! will simply not contain this new type of event and therefore only explore
//! the subgraph of the state machine diagram which corresponds to the older
//! version of the state machine. New sessions which do contain this event will
//! not be interpretable by the old code.

use std::fmt;

/// Representation of the actions that the persister should take, if any.
Expand Down
Loading