pub struct GenericTransition<T> {
pub transaction_id: u128,
pub sequence: i64,
pub timestamp_ms: i64,
pub kind: TransitionKind,
pub before: GenericDoubletLink<T>,
pub after: GenericDoubletLink<T>,
}Expand description
Reversible write captured by the transactions layer. Holds both
before and after link states so the operation can be undone or
replayed.
Fields§
§transaction_id: u128§sequence: i64§timestamp_ms: i64§kind: TransitionKind§before: GenericDoubletLink<T>§after: GenericDoubletLink<T>Implementations§
Source§impl<T: LinkReference> GenericTransition<T>
impl<T: LinkReference> GenericTransition<T>
pub const SCHEMA_VERSION: &'static str = "v1"
Sourcepub fn serialize(&self) -> String
pub fn serialize(&self) -> String
Encodes the transition as a single line stored as one entry of the transitions log.
Addresses are written in decimal, so a log written by a
u32-addressed store reads back unchanged in a u64- or
usize-addressed one.
Sourcepub fn parse(text: &str) -> Result<Self, LinkError>
pub fn parse(text: &str) -> Result<Self, LinkError>
Parses a serialized transition.
Returns LinkError::InvalidFormat for anything that is not a
well-formed entry — including the partial line a crash can leave
at the end of an append-only log — and
LinkError::AddressOutOfRange for a structurally valid entry
whose addresses do not fit into T. The two are distinct on
purpose: recovery skips torn entries but must not silently drop
a log written by a wider address type.
Sourcepub fn try_parse(text: &str) -> Option<Self>
pub fn try_parse(text: &str) -> Option<Self>
Lenient variant of GenericTransition::parse.
Trait Implementations§
Source§impl<T: Clone> Clone for GenericTransition<T>
impl<T: Clone> Clone for GenericTransition<T>
Source§fn clone(&self) -> GenericTransition<T>
fn clone(&self) -> GenericTransition<T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more