pub struct NetworkConnection { /* private fields */ }Expand description
Represents an active network connection to a remote Raft node. Handles serialization and deserialization of Raft messages over gRPC.
Implementations§
Source§impl NetworkConnection
impl NetworkConnection
Sourcepub fn new(target_node: <TypeConfig as RaftTypeConfig>::Node) -> Self
pub fn new(target_node: <TypeConfig as RaftTypeConfig>::Node) -> Self
Creates a new NetworkConnection with the provided gRPC client.
Trait Implementations§
Source§impl NetBackoff<TypeConfig> for NetworkConnection
impl NetBackoff<TypeConfig> for NetworkConnection
Source§impl NetSnapshot<TypeConfig> for NetworkConnection
impl NetSnapshot<TypeConfig> for NetworkConnection
Source§async fn full_snapshot(
&mut self,
vote: <TypeConfig as RaftTypeConfig>::Vote,
snapshot: Snapshot<TypeConfig>,
_cancel: impl Future<Output = ReplicationClosed> + OptionalSend + 'static,
_option: RPCOption,
) -> Result<SnapshotResponse<TypeConfig>, StreamingError<TypeConfig>>
async fn full_snapshot( &mut self, vote: <TypeConfig as RaftTypeConfig>::Vote, snapshot: Snapshot<TypeConfig>, _cancel: impl Future<Output = ReplicationClosed> + OptionalSend + 'static, _option: RPCOption, ) -> Result<SnapshotResponse<TypeConfig>, StreamingError<TypeConfig>>
Send a complete Snapshot to the target. Read more
Source§impl NetStreamAppend<TypeConfig> for NetworkConnection
impl NetStreamAppend<TypeConfig> for NetworkConnection
Source§fn stream_append<'s, S>(
&'s mut self,
input: S,
_option: RPCOption,
) -> BoxFuture<'s, Result<BoxStream<'s, Result<StreamAppendResult<TypeConfig>, RPCError<TypeConfig, Infallible>>>, RPCError<TypeConfig, Infallible>>>
fn stream_append<'s, S>( &'s mut self, input: S, _option: RPCOption, ) -> BoxFuture<'s, Result<BoxStream<'s, Result<StreamAppendResult<TypeConfig>, RPCError<TypeConfig, Infallible>>>, RPCError<TypeConfig, Infallible>>>
Send a stream of AppendEntries RPCs to the target and return a stream of responses. Read more
Source§impl NetTransferLeader<TypeConfig> for NetworkConnection
impl NetTransferLeader<TypeConfig> for NetworkConnection
Source§async fn transfer_leader(
&mut self,
_req: TransferLeaderRequest<TypeConfig>,
_option: RPCOption,
) -> Result<(), RPCError<TypeConfig, Infallible>>
async fn transfer_leader( &mut self, _req: TransferLeaderRequest<TypeConfig>, _option: RPCOption, ) -> Result<(), RPCError<TypeConfig, Infallible>>
Send TransferLeader message to the target node. Read more
Source§impl NetVote<TypeConfig> for NetworkConnection
impl NetVote<TypeConfig> for NetworkConnection
Source§async fn vote(
&mut self,
req: VoteRequest<TypeConfig>,
_option: RPCOption,
) -> Result<VoteResponse<TypeConfig>, RPCError<TypeConfig, Infallible>>
async fn vote( &mut self, req: VoteRequest<TypeConfig>, _option: RPCOption, ) -> Result<VoteResponse<TypeConfig>, RPCError<TypeConfig, Infallible>>
Send a RequestVote RPC to the target.
Auto Trait Implementations§
impl Freeze for NetworkConnection
impl RefUnwindSafe for NetworkConnection
impl Send for NetworkConnection
impl Sync for NetworkConnection
impl Unpin for NetworkConnection
impl UnsafeUnpin for NetworkConnection
impl UnwindSafe for NetworkConnection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request