[−][src]Struct actix_raft::messages::VoteRequest
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]
target: u64,
term: u64,
candidate_id: u64,
last_log_index: u64,
last_log_term: u64
) -> Self
Create a new instance.
Trait Implementations
impl Debug for VoteRequest
[src]
impl<'de> Deserialize<'de> for VoteRequest
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
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:
- Reply
false
ifterm
is less than receiver's currentterm
(§5.1). - If receiver has not cast a vote for the current
term
or it voted forcandidate_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
impl RefUnwindSafe for VoteRequest
impl Send for VoteRequest
impl Sync for VoteRequest
impl Unpin for VoteRequest
impl UnwindSafe for VoteRequest
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,