Skip to main content

IntermediaryConnection

Struct IntermediaryConnection 

Source
pub struct IntermediaryConnection<DT, UT, State, Peer, ServerIdentity, ClientEvidence, ServerHandler, ClientHandler, Boundary, Policy, Cancellation = RejectCancellation> { /* private fields */ }
Expand description

One operational, independently authenticated intermediary session.

Implementations§

Source§

impl<DT, UT, State, Peer, SI, CE, SH, CH, Boundary, Policy, K> IntermediaryConnection<DT, UT, State, Peer, SI, CE, SH, CH, Boundary, Policy, K>
where Policy: PipelinePolicy,

Source

pub const fn target(&self) -> &ConnectTarget

Returns the authoritative destination selected for the client component.

Source

pub const fn state(&self) -> &State

Returns the single caller-owned state shared by all three middleware layers.

Source

pub const fn cancellation_key(&self) -> Option<&CancelKey>

Returns the proxy-issued cancellation key for this live session.

Source

pub fn held_backend_messages(&self) -> HeldBackendMessages<'_>

Returns an ordered borrowed view of retained backend messages.

Source

pub fn detach_cancellation(&mut self) -> Option<CancellationRoute>

Detaches this session’s cancellation mapping explicitly.

Source§

impl<DT, UT, State, Peer, ServerIdentity, ClientEvidence, ServerHandler, ClientHandler, Boundary, Policy, K> IntermediaryConnection<DT, UT, State, Peer, ServerIdentity, ClientEvidence, ServerHandler, ClientHandler, Boundary, Policy, K>
where DT: AsyncRead + AsyncWrite + Unpin, UT: AsyncRead + AsyncWrite + Unpin, ServerHandler: ServerMiddleware<State, ServerConnectionContext<Peer, ServerIdentity>>, ClientHandler: ClientMiddleware<State, ClientConnectionContext<ClientEvidence>>, Boundary: IntermediaryMiddleware<State, ServerConnectionContext<Peer, ServerIdentity>, ClientConnectionContext<ClientEvidence>>, Policy: PipelinePolicy, K: IntermediaryCancellationRegistry,

Source

pub async fn forward_frontend( &mut self, ) -> Result<FrontendForwarding, ForwardError<Boundary::Error>>

Receives one client message and reports whether it was forwarded, suppressed, or handled with pipeline-ordered local responses.

§Errors

Returns middleware, transport, protocol-legality, or capacity failures.

Source

pub async fn forward_backend( &mut self, ) -> Result<BackendForwarding, ForwardError<Boundary::Error>>

Receives one legal PostgreSQL response and forwards it downstream in source-role, boundary, destination-role middleware order.

§Errors

Returns transport, framing, ordering, or protocol-legality failures. Receives one PostgreSQL response and reports whether it was forwarded, expanded, or suppressed.

§Errors

Returns middleware, transport, ordering, or protocol-legality failures.

Source

pub async fn flush_backend_hold( &mut self, ) -> Result<BackendBatchForwarding, ForwardError<Boundary::Error>>

Applies batch policy to held messages without reading another upstream frame.

§Errors

Returns middleware, encoding, projection, or transport failures while preserving the hold until projection commits.

Source

pub async fn prepare_backend_teardown( &mut self, ) -> Result<BackendBatchForwarding, ForwardError<Boundary::Error>>

Flushes retained messages for deliberate teardown without reading upstream.

§Errors

Returns an error when middleware fails, refuses release, proposes an invalid span, or output cannot be encoded or written.

Source

pub async fn forward_next( &mut self, ) -> Result<ForwardedMessage, ForwardError<Boundary::Error>>

Waits on both transports and forwards whichever legal message becomes available first. This is the duplex driver for asynchronous traffic, COPY BOTH, and physical replication.

When frontend capacity is exhausted, the unchanged pending request is retained and only backend progress is polled until capacity recovers.

§Errors

Returns transport, framing, ordering, protocol-legality, or capacity failures.

Source

pub fn teardown( self, ) -> (AcceptedServerTransport<DT>, ClientTransport<UT>, State, Boundary, (ServerHandler, ClientHandler), IntermediaryContexts<ServerConnectionContext<Peer, ServerIdentity>, ClientConnectionContext<ClientEvidence>>)

Deliberately tears down both roles and recovers transports, handlers, contexts, boundary middleware, and the sole connection state.

§Panics

Panics when a backend source is pending or held. Call Self::prepare_backend_teardown first when batching is enabled.

Auto Trait Implementations§

§

impl<DT, UT, State, Peer, ServerIdentity, ClientEvidence, ServerHandler, ClientHandler, Boundary, Policy, Cancellation = RejectCancellation> !Freeze for IntermediaryConnection<DT, UT, State, Peer, ServerIdentity, ClientEvidence, ServerHandler, ClientHandler, Boundary, Policy, Cancellation>

§

impl<DT, UT, State, Peer, ServerIdentity, ClientEvidence, ServerHandler, ClientHandler, Boundary, Policy, Cancellation = RejectCancellation> !RefUnwindSafe for IntermediaryConnection<DT, UT, State, Peer, ServerIdentity, ClientEvidence, ServerHandler, ClientHandler, Boundary, Policy, Cancellation>

§

impl<DT, UT, State, Peer, ServerIdentity, ClientEvidence, ServerHandler, ClientHandler, Boundary, Policy, Cancellation = RejectCancellation> !UnwindSafe for IntermediaryConnection<DT, UT, State, Peer, ServerIdentity, ClientEvidence, ServerHandler, ClientHandler, Boundary, Policy, Cancellation>

§

impl<DT, UT, State, Peer, ServerIdentity, ClientEvidence, ServerHandler, ClientHandler, Boundary, Policy, Cancellation> Send for IntermediaryConnection<DT, UT, State, Peer, ServerIdentity, ClientEvidence, ServerHandler, ClientHandler, Boundary, Policy, Cancellation>
where State: Send, Boundary: Send, Cancellation: Send, ServerHandler: Send, ClientHandler: Send, Policy: Send, Peer: Send, ServerIdentity: Send, ClientEvidence: Send, UT: Send, DT: Send,

§

impl<DT, UT, State, Peer, ServerIdentity, ClientEvidence, ServerHandler, ClientHandler, Boundary, Policy, Cancellation> Sync for IntermediaryConnection<DT, UT, State, Peer, ServerIdentity, ClientEvidence, ServerHandler, ClientHandler, Boundary, Policy, Cancellation>
where State: Sync, Boundary: Sync, Cancellation: Sync, ServerHandler: Sync, ClientHandler: Sync, Policy: Sync, Peer: Sync, ServerIdentity: Sync, ClientEvidence: Sync, UT: Sync, DT: Sync,

§

impl<DT, UT, State, Peer, ServerIdentity, ClientEvidence, ServerHandler, ClientHandler, Boundary, Policy, Cancellation> Unpin for IntermediaryConnection<DT, UT, State, Peer, ServerIdentity, ClientEvidence, ServerHandler, ClientHandler, Boundary, Policy, Cancellation>
where State: Unpin, Boundary: Unpin, Cancellation: Unpin, ServerHandler: Unpin, ClientHandler: Unpin, Policy: Unpin, Peer: Unpin, ServerIdentity: Unpin, ClientEvidence: Unpin, UT: Unpin,

§

impl<DT, UT, State, Peer, ServerIdentity, ClientEvidence, ServerHandler, ClientHandler, Boundary, Policy, Cancellation> UnsafeUnpin for IntermediaryConnection<DT, UT, State, Peer, ServerIdentity, ClientEvidence, ServerHandler, ClientHandler, Boundary, Policy, Cancellation>
where State: UnsafeUnpin, Boundary: UnsafeUnpin, Cancellation: UnsafeUnpin, ServerHandler: UnsafeUnpin, ClientHandler: UnsafeUnpin, Policy: UnsafeUnpin, Peer: UnsafeUnpin, ServerIdentity: UnsafeUnpin, ClientEvidence: UnsafeUnpin, UT: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.