Struct mz_balancerd::codec::FramedConn
source · pub struct FramedConn<A> {
inner: Buffer<Framed<Conn<A>, Codec>, BackendMessage>,
}
Expand description
A connection that manages the encoding and decoding of pgwire frames.
Fields§
§inner: Buffer<Framed<Conn<A>, Codec>, BackendMessage>
Implementations§
source§impl<A> FramedConn<A>
impl<A> FramedConn<A>
sourcepub fn new(inner: Conn<A>) -> FramedConn<A>
pub fn new(inner: Conn<A>) -> FramedConn<A>
Constructs a new framed connection.
The underlying connection, inner
, is expected to be something like a
TCP stream. Anything that implements AsyncRead
and AsyncWrite
will do.
sourcepub async fn recv(&mut self) -> Result<Option<FrontendMessage>, Error>
pub async fn recv(&mut self) -> Result<Option<FrontendMessage>, Error>
Reads and decodes one frontend message from the client.
Blocks until the client sends a complete message. If the client
terminates the stream, returns None
. Returns an error if the client
sends a malformed message or if the connection underlying is broken.
§Cancel safety
This method is cancel safe. The returned future only holds onto a reference to thea underlying stream, so dropping it will never lose a value.
https://docs.rs/tokio-stream/latest/tokio_stream/trait.StreamExt.html#cancel-safety-1
sourcepub async fn send<M>(&mut self, message: M) -> Result<(), Error>where
M: Into<BackendMessage>,
pub async fn send<M>(&mut self, message: M) -> Result<(), Error>where
M: Into<BackendMessage>,
Encodes and sends one backend message to the client.
Note that the connection is not flushed after calling this method. You
must call FramedConn::flush
explicitly. Returns an error if the
underlying connection is broken.
Please use StateMachine::send
instead if calling from StateMachine
,
as it applies session-based filters before calling this method.
Trait Implementations§
source§impl<A> AsyncReady for FramedConn<A>
impl<A> AsyncReady for FramedConn<A>
Auto Trait Implementations§
impl<A> Freeze for FramedConn<A>where
A: Freeze,
impl<A> RefUnwindSafe for FramedConn<A>where
A: RefUnwindSafe,
impl<A> Send for FramedConn<A>where
A: Send,
impl<A> Sync for FramedConn<A>where
A: Sync,
impl<A> Unpin for FramedConn<A>where
A: Unpin,
impl<A> UnwindSafe for FramedConn<A>where
A: 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
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
source§impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
type Error = <Target as OctetsFrom<Source>>::Error
source§fn try_octets_into(
self,
) -> Result<Target, <Source as OctetsInto<Target>>::Error>
fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>
source§fn octets_into(self) -> Target
fn octets_into(self) -> Target
source§impl<T, U> OverrideFrom<Option<&T>> for Uwhere
U: OverrideFrom<T>,
impl<T, U> OverrideFrom<Option<&T>> for Uwhere
U: OverrideFrom<T>,
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
source§fn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
RustType::from_proto
.source§fn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
RustType::into_proto
.source§impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
source§fn plus_equals(&mut self, rhs: &&'a S)
fn plus_equals(&mut self, rhs: &&'a S)
std::ops::AddAssign
, for types that do not implement AddAssign
.