Struct Transition
pub struct Transition<T>where
T: LinkReference,{
pub transaction_id: u64,
pub sequence: u64,
pub kind: TransitionKind,
pub before: Link<T>,
pub after: Link<T>,
}Expand description
A reversible mutation, including both link states.
Fields§
§transaction_id: u64Journal-local transaction identifier.
sequence: u64Journal-local, monotonically increasing write sequence.
kind: TransitionKindThe kind of mutation.
before: Link<T>Link state before mutation; the null link for creation.
after: Link<T>Link state after mutation; the null link for deletion.
Implementations§
§impl<T> Transition<T>where
T: LinkReference,
impl<T> Transition<T>where
T: LinkReference,
pub fn new(
transaction_id: u64,
sequence: u64,
before: Link<T>,
after: Link<T>,
) -> Transition<T>
pub fn new( transaction_id: u64, sequence: u64, before: Link<T>, after: Link<T>, ) -> Transition<T>
Constructs a transition, inferring its kind from the null side.
pub fn apply<L>(&self, links: &mut L) -> Result<(), Error<T>>where
L: Doublets<T>,
pub fn apply<L>(&self, links: &mut L) -> Result<(), Error<T>>where
L: Doublets<T>,
Applies this write without generating another journal record.
Repeated application is harmless. The store must support raw writes and exact-address restoration through sequential allocation (as both supplied stores do). This reconstructs the graph with O(number of links + highest address) store operations, plus sorting and backend index costs.
pub fn revert<L>(&self, links: &mut L) -> Result<(), Error<T>>where
L: Doublets<T>,
pub fn revert<L>(&self, links: &mut L) -> Result<(), Error<T>>where
L: Doublets<T>,
Reverts this write without generating another journal record.
Like Self::apply, this is idempotent and preserves link addresses.
Trait Implementations§
§impl<T> Clone for Transition<T>where
T: Clone + LinkReference,
impl<T> Clone for Transition<T>where
T: Clone + LinkReference,
§fn clone(&self) -> Transition<T>
fn clone(&self) -> Transition<T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more