pub struct MutableQ42Session<S: Read + Write + Seek> {
pub journal: Q42Journal<S>,
pub active_state: HashSet<NQuin>,
/* private fields */
}Expand description
Generalized in-memory mutable session providing active state projection, transaction commit boundaries, and checkpoint management.
Fields§
§journal: Q42Journal<S>§active_state: HashSet<NQuin>Implementations§
Source§impl<S: Read + Write + Seek> MutableQ42Session<S>
impl<S: Read + Write + Seek> MutableQ42Session<S>
Sourcepub fn open(
journal: Q42Journal<S>,
baseline_quins: &[NQuin],
) -> Result<Self, JournalError>
pub fn open( journal: Q42Journal<S>, baseline_quins: &[NQuin], ) -> Result<Self, JournalError>
Open a mutable session over an existing or new journal and baseline Quins.
Sourcepub fn current_tick(&self) -> u64
pub fn current_tick(&self) -> u64
The session’s current logical clock (Lamport tick).
Sourcepub fn advance_tick(&mut self, tick: u64)
pub fn advance_tick(&mut self, tick: u64)
Advances the session clock to tick (callers should pass a
monotonically increasing value).
Sourcepub fn stage_add(&mut self, quin: NQuin)
pub fn stage_add(&mut self, quin: NQuin)
Stage a Quin addition in the current uncommitted scratch buffer.
Sourcepub fn stage_remove(&mut self, quin: NQuin)
pub fn stage_remove(&mut self, quin: NQuin)
Stage a Quin removal in the current uncommitted scratch buffer.
Sourcepub fn rollback_staged(&mut self)
pub fn rollback_staged(&mut self)
Discard all uncommitted staged deltas.
Sourcepub fn commit_transaction(
&mut self,
command_hash: u64,
actor_did: u64,
) -> Result<u32, JournalError>
pub fn commit_transaction( &mut self, command_hash: u64, actor_did: u64, ) -> Result<u32, JournalError>
Commit all staged deltas atomically into the durable .q42j journal
and apply them to the active in-memory semantic state.
Sourcepub fn checkpoint(
&mut self,
new_base_digest: [u8; 32],
new_generation: u64,
) -> Result<(), JournalError>
pub fn checkpoint( &mut self, new_base_digest: [u8; 32], new_generation: u64, ) -> Result<(), JournalError>
Checkpoint the active state into a new sealed generation.
Sourcepub fn rewind_to_tick(
&mut self,
baseline_quins: &[NQuin],
target_tick: u64,
) -> Result<(), JournalError>
pub fn rewind_to_tick( &mut self, baseline_quins: &[NQuin], target_tick: u64, ) -> Result<(), JournalError>
Replay active state from baseline snapshot up to a specific tick target.
Auto Trait Implementations§
impl<S> Freeze for MutableQ42Session<S>where
S: Freeze,
impl<S> RefUnwindSafe for MutableQ42Session<S>where
S: RefUnwindSafe,
impl<S> Send for MutableQ42Session<S>where
S: Send,
impl<S> Sync for MutableQ42Session<S>where
S: Sync,
impl<S> Unpin for MutableQ42Session<S>where
S: Unpin,
impl<S> UnsafeUnpin for MutableQ42Session<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for MutableQ42Session<S>where
S: UnwindSafe,
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more