pub struct Transaction { /* private fields */ }Expand description
One in-flight change of the protected headers of a cluster, as the main process sees it. Persistable: see the module documentation.
Implementations§
Source§impl Transaction
impl Transaction
Sourcepub fn begin(
journal: &mut ProtectedHeaderJournal,
cluster_id: &str,
change: ProtectedHeaderChange,
workers: impl IntoIterator<Item = WorkerId>,
) -> Result<Self, BeginError>
pub fn begin( journal: &mut ProtectedHeaderJournal, cluster_id: &str, change: ProtectedHeaderChange, workers: impl IntoIterator<Item = WorkerId>, ) -> Result<Self, BeginError>
Propose change for cluster_id and target workers. Refused before
the journal is touched when there is no worker.
pub fn cluster_id(&self) -> &str
pub fn version(&self) -> ProtectedHeaderVersion
pub fn phase(&self) -> Phase
pub fn is_finished(&self) -> bool
Sourcepub fn workers(&self) -> Vec<WorkerId> ⓘ
pub fn workers(&self) -> Vec<WorkerId> ⓘ
Every targeted worker, in order: the recipients of the prepare order.
Sourcepub fn prepared(
&mut self,
worker: WorkerId,
version: ProtectedHeaderVersion,
) -> Step
pub fn prepared( &mut self, worker: WorkerId, version: ProtectedHeaderVersion, ) -> Step
worker staged version.
Sourcepub fn committed(
&mut self,
journal: &mut ProtectedHeaderJournal,
worker: WorkerId,
version: ProtectedHeaderVersion,
) -> Step
pub fn committed( &mut self, journal: &mut ProtectedHeaderJournal, worker: WorkerId, version: ProtectedHeaderVersion, ) -> Step
worker applied version; the last acknowledgement confirms it.
Sourcepub fn failed(
&mut self,
journal: &mut ProtectedHeaderJournal,
worker: WorkerId,
version: ProtectedHeaderVersion,
) -> Step
pub fn failed( &mut self, journal: &mut ProtectedHeaderJournal, worker: WorkerId, version: ProtectedHeaderVersion, ) -> Step
worker refused version, or the order to it could not be queued.
Before the commit is confirmed that starts the abort of every worker; a
failed abort marks the worker as unrecoverable.
Sourcepub fn aborted(
&mut self,
journal: &mut ProtectedHeaderJournal,
worker: WorkerId,
version: ProtectedHeaderVersion,
) -> Step
pub fn aborted( &mut self, journal: &mut ProtectedHeaderJournal, worker: WorkerId, version: ProtectedHeaderVersion, ) -> Step
worker dropped or undid version.
Sourcepub fn timed_out(&mut self, journal: &mut ProtectedHeaderJournal) -> Step
pub fn timed_out(&mut self, journal: &mut ProtectedHeaderJournal) -> Step
The deadline passed. A transaction not yet aborting starts to abort; one already aborting gives up on the workers that did not answer.
Trait Implementations§
Source§impl Clone for Transaction
impl Clone for Transaction
Source§impl Debug for Transaction
impl Debug for Transaction
Source§impl<'de> Deserialize<'de> for Transaction
impl<'de> Deserialize<'de> for Transaction
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Transaction
Source§impl PartialEq for Transaction
impl PartialEq for Transaction
Source§impl Serialize for Transaction
impl Serialize for Transaction
impl StructuralPartialEq for Transaction
Auto Trait Implementations§
impl Freeze for Transaction
impl RefUnwindSafe for Transaction
impl Send for Transaction
impl Sync for Transaction
impl Unpin for Transaction
impl UnsafeUnpin for Transaction
impl UnwindSafe for Transaction
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.