pub struct ClientHandler { /* private fields */ }Expand description
Client-side request handler bundle.
Built by crate::net::proxy::Proxy and passed into
client_loop.
Implementations§
Source§impl ClientHandler
impl ClientHandler
Sourcepub fn new(
dispatcher: Arc<dyn Dispatcher>,
response_tx: Sender<OutboundEnvelope>,
data_store: DataStore,
) -> Self
pub fn new( dispatcher: Arc<dyn Dispatcher>, response_tx: Sender<OutboundEnvelope>, data_store: DataStore, ) -> Self
Build a client handler.
§Examples
use dynomite::conf::DataStore;
use dynomite::net::{ClientHandler, NoopDispatcher};
use std::sync::Arc;
use tokio::sync::mpsc;
let (tx, _rx) = mpsc::channel(1);
let _h = ClientHandler::new(Arc::new(NoopDispatcher), tx, DataStore::Redis);Sourcepub fn with_read_timeout(self, t: Option<Duration>) -> Self
pub fn with_read_timeout(self, t: Option<Duration>) -> Self
Set the per-read timeout. None disables it.
Sourcepub fn with_gossip(self, gossip: Arc<GossipHandler>) -> Self
pub fn with_gossip(self, gossip: Arc<GossipHandler>) -> Self
Attach a gossip handler. Inbound peer connections served
through this handler dispatch gossip-class dnode frames
into the supplied handler instead of the datastore parser.
Data-plane connections (CLIENT role) leave it None.
Sourcepub fn gossip(&self) -> Option<&Arc<GossipHandler>>
pub fn gossip(&self) -> Option<&Arc<GossipHandler>>
Borrow the attached gossip handler, if any.
Sourcepub fn data_store(&self) -> DataStore
pub fn data_store(&self) -> DataStore
Datastore the handler parses.
Sourcepub fn dispatcher(&self) -> &Arc<dyn Dispatcher> ⓘ
pub fn dispatcher(&self) -> &Arc<dyn Dispatcher> ⓘ
Borrow the dispatcher this handler routes parsed requests into. Exposed so role-specific drivers (CLIENT, DNODE_PEER_CLIENT) can share the same dispatch contract.
§Examples
use dynomite::conf::DataStore;
use dynomite::net::{ClientHandler, NoopDispatcher};
use std::sync::Arc;
use tokio::sync::mpsc;
let (tx, _rx) = mpsc::channel(1);
let h = ClientHandler::new(Arc::new(NoopDispatcher), tx, DataStore::Redis);
let _ = h.dispatcher();Sourcepub fn response_tx(&self) -> &Sender<OutboundEnvelope>
pub fn response_tx(&self) -> &Sender<OutboundEnvelope>
Borrow the per-connection response sender. The dispatcher uses a clone of this channel to push asynchronously-produced responses back to the FSM.
§Examples
use dynomite::conf::DataStore;
use dynomite::net::{ClientHandler, NoopDispatcher};
use std::sync::Arc;
use tokio::sync::mpsc;
let (tx, _rx) = mpsc::channel(1);
let h = ClientHandler::new(Arc::new(NoopDispatcher), tx, DataStore::Redis);
let _clone = h.response_tx().clone();Auto Trait Implementations§
impl Freeze for ClientHandler
impl !RefUnwindSafe for ClientHandler
impl Send for ClientHandler
impl Sync for ClientHandler
impl Unpin for ClientHandler
impl UnsafeUnpin for ClientHandler
impl !UnwindSafe for ClientHandler
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.