[][src]Struct actix_raft::messages::InstallSnapshotRequest

pub struct InstallSnapshotRequest {
    pub target: u64,
    pub term: u64,
    pub leader_id: u64,
    pub last_included_index: u64,
    pub last_included_term: u64,
    pub offset: u64,
    pub data: Vec<u8>,
    pub done: bool,
}

Invoked by the Raft leader to send chunks of a snapshot to a follower (§7).

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<InstallSnapshotResponse, ()>. 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 leader's current term.

leader_id: u64

The leader's ID. Useful in redirecting clients.

last_included_index: u64

The snapshot replaces all log entries up through and including this index.

last_included_term: u64

The term of the last_included_index.

offset: u64

The byte offset where chunk is positioned in the snapshot file.

data: Vec<u8>

The raw Vec of the snapshot chunk, starting at offset.

done: bool

Will be true if this is the last chunk in the snapshot.

Trait Implementations

impl Clone for InstallSnapshotRequest[src]

impl Debug for InstallSnapshotRequest[src]

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

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

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

The type of value that this handler will return.

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

Invoked by leader to send chunks of a snapshot to a follower (§7).

Leaders always send chunks in order. It is important to note that, according to the Raft spec, a log may only have one snapshot at any time. As snapshot contents are application specific, the Raft log will only store a pointer to the snapshot file along with the index & term.

See the storage::InstallSnapshot type for implementaion details.

impl Message for InstallSnapshotRequest[src]

type Result = Result<InstallSnapshotResponse, ()>

The result type of this message.

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

impl Serialize for InstallSnapshotRequest[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: for<'de> Deserialize<'de>, 
[src]

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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>,