Struct raft::Changer[][src]

pub struct Changer<'a> { /* fields omitted */ }

Changer facilitates configuration changes. It exposes methods to handle simple and joint consensus while performing the proper validation that allows refusing invalid configuration changes before they affect the active configuration.

Implementations

impl Changer<'_>[src]

pub fn new(tracker: &ProgressTracker) -> Changer<'_>[src]

Creates a changer.

pub fn enter_joint(
    &self,
    auto_leave: bool,
    ccs: &[ConfChangeSingle]
) -> Result<(Configuration, MapChange)>
[src]

Verifies that the outgoing (=right) majority config of the joint config is empty and initializes it with a copy of the incoming (=left) majority config. That is, it transitions from

    (1 2 3)&&()

to

    (1 2 3)&&(1 2 3)
```.

The supplied changes are then applied to the incoming majority config,
resulting in a joint configuration that in terms of the Raft thesis[1]
(Section 4.3) corresponds to `C_{new,old}`.

[1]: https://github.com/ongardie/dissertation/blob/master/online-trim.pdf

pub fn leave_joint(&self) -> Result<(Configuration, MapChange)>[src]

Transitions out of a joint configuration. It is an error to call this method if the configuration is not joint, i.e. if the outgoing majority config is empty.

The outgoing majority config of the joint configuration will be removed, that is, the incoming config is promoted as the sole decision maker. In the notation of the Raft thesis1 (Section 4.3), this method transitions from C_{new,old} into C_new.

At the same time, any staged learners (LearnersNext) the addition of which was held back by an overlapping voter in the former outgoing config will be inserted into Learners.

pub fn simple(
    &mut self,
    ccs: &[ConfChangeSingle]
) -> Result<(Configuration, MapChange)>
[src]

Carries out a series of configuration changes that (in aggregate) mutates the incoming majority config Voters[0] by at most one. This method will return an error if that is not the case, if the resulting quorum is zero, or if the configuration is in a joint state (i.e. if there is an outgoing configuration).

Auto Trait Implementations

impl<'a> RefUnwindSafe for Changer<'a>

impl<'a> Send for Changer<'a>

impl<'a> Sync for Changer<'a>

impl<'a> Unpin for Changer<'a>

impl<'a> UnwindSafe for Changer<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SendSyncUnwindSafe for T where
    T: Send + Sync + UnwindSafe + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]