Struct raft::Changer[][src]

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

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

Creates a changer.

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

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.

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

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.