[][src]Struct actix_raft::messages::VoteRequest

pub struct VoteRequest {
    pub target: u64,
    pub term: u64,
    pub candidate_id: u64,
    pub last_log_index: u64,
    pub last_log_term: u64,
}

An RPC invoked by candidates to gather votes (§5.2).

actix::Message

Applications using this Raft implementation are responsible for implementing the networking/transport layer which must move RPCs between nodes. Once the application instance recieves a Raft RPC, it must send the RPC to the Raft node via its actix::Addr and then return the response to the original sender.

The result type of calling the Raft actor with this message type is Result<VoteResponse, ()>. The Raft spec assigns no significance to failures during the handling or sending of RPCs and all RPCs are handled in an idempotent fashion, so Raft will almost always retry sending a failed RPC, depending on the state of the Raft.

Fields

target: u64

A non-standard field, this is the ID of the intended recipient of this RPC.

term: u64

The candidate's current term.

candidate_id: u64

The candidate's ID.

last_log_index: u64

The index of the candidate’s last log entry (§5.4).

last_log_term: u64

The term of the candidate’s last log entry (§5.4).

Methods

impl VoteRequest[src]

pub fn new(
    target: u64,
    term: u64,
    candidate_id: u64,
    last_log_index: u64,
    last_log_term: u64
) -> Self
[src]

Create a new instance.

Trait Implementations

impl Debug for VoteRequest[src]

impl<'de> Deserialize<'de> for VoteRequest[src]

impl<D: AppData, R: AppDataResponse, E: AppError, N: RaftNetwork<D>, S: RaftStorage<D, R, E>> Handler<VoteRequest> for Raft<D, R, E, N, S>[src]

type Result = ResponseActFuture<Self, VoteResponse, ()>

The type of value that this handler will return.

fn handle(&mut self, msg: VoteRequest, ctx: &mut Self::Context) -> Self::Result[src]

An RPC invoked by candidates to gather votes (§5.2).

Receiver implementation:

  1. Reply false if term is less than receiver's current term (§5.1).
  2. If receiver has not cast a vote for the current term or it voted for candidate_id, and candidate’s log is atleast as up-to-date as receiver’s log, grant vote (§5.2, §5.4).

impl Message for VoteRequest[src]

type Result = Result<VoteResponse, ()>

The result type of this message.

The Result::Err type is () as Raft assigns no significance to RPC failures, they will be retried almost always as long as permitted by the current state of the Raft.

impl Serialize for VoteRequest[src]

Auto Trait Implementations

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> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[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>,