Struct openraft::impls::OneshotResponder
source · pub struct OneshotResponder<C>where
C: RaftTypeConfig,{ /* private fields */ }
Expand description
A Responder
implementation that sends the response via a oneshot channel.
This could be used when the Raft::client_write
caller want to wait for the response.
Implementations§
source§impl<C> OneshotResponder<C>where
C: RaftTypeConfig,
impl<C> OneshotResponder<C>where
C: RaftTypeConfig,
sourcepub fn new(
tx: <<C as RaftTypeConfig>::AsyncRuntime as AsyncRuntime>::OneshotSender<ClientWriteResult<C>>,
) -> Self
pub fn new( tx: <<C as RaftTypeConfig>::AsyncRuntime as AsyncRuntime>::OneshotSender<ClientWriteResult<C>>, ) -> Self
Create a new instance from a AsyncRuntime::OneshotSender
.
Trait Implementations§
source§impl<C> Responder<C> for OneshotResponder<C>where
C: RaftTypeConfig,
impl<C> Responder<C> for OneshotResponder<C>where
C: RaftTypeConfig,
source§type Receiver = <<C as RaftTypeConfig>::AsyncRuntime as AsyncRuntime>::OneshotReceiver<Result<ClientWriteResponse<C>, ClientWriteError<<C as RaftTypeConfig>::NodeId, <C as RaftTypeConfig>::Node>>>
type Receiver = <<C as RaftTypeConfig>::AsyncRuntime as AsyncRuntime>::OneshotReceiver<Result<ClientWriteResponse<C>, ClientWriteError<<C as RaftTypeConfig>::NodeId, <C as RaftTypeConfig>::Node>>>
An optional receiver to receive the result sent by
RaftCore
. Read moresource§fn from_app_data(app_data: C::D) -> (C::D, Self, Self::Receiver)where
Self: Sized,
fn from_app_data(app_data: C::D) -> (C::D, Self, Self::Receiver)where
Self: Sized,
Build a new instance from the application request.
source§fn send(self, res: ClientWriteResult<C>)
fn send(self, res: ClientWriteResult<C>)
Send result when the request has been completed. Read more
Auto Trait Implementations§
impl<C> Freeze for OneshotResponder<C>where
<<C as RaftTypeConfig>::AsyncRuntime as AsyncRuntime>::OneshotSender<Result<ClientWriteResponse<C>, ClientWriteError<<C as RaftTypeConfig>::NodeId, <C as RaftTypeConfig>::Node>>>: Freeze,
impl<C> RefUnwindSafe for OneshotResponder<C>where
<<C as RaftTypeConfig>::AsyncRuntime as AsyncRuntime>::OneshotSender<Result<ClientWriteResponse<C>, ClientWriteError<<C as RaftTypeConfig>::NodeId, <C as RaftTypeConfig>::Node>>>: RefUnwindSafe,
impl<C> Send for OneshotResponder<C>
impl<C> Sync for OneshotResponder<C>
impl<C> Unpin for OneshotResponder<C>where
<<C as RaftTypeConfig>::AsyncRuntime as AsyncRuntime>::OneshotSender<Result<ClientWriteResponse<C>, ClientWriteError<<C as RaftTypeConfig>::NodeId, <C as RaftTypeConfig>::Node>>>: Unpin,
impl<C> UnwindSafe for OneshotResponder<C>where
<<C as RaftTypeConfig>::AsyncRuntime as AsyncRuntime>::OneshotSender<Result<ClientWriteResponse<C>, ClientWriteError<<C as RaftTypeConfig>::NodeId, <C as RaftTypeConfig>::Node>>>: UnwindSafe,
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