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,
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,
Sourcepub const fn target(&self) -> &ConnectTarget
pub const fn target(&self) -> &ConnectTarget
Returns the authoritative destination selected for the client component.
Sourcepub const fn state(&self) -> &State
pub const fn state(&self) -> &State
Returns the single caller-owned state shared by all three middleware layers.
Sourcepub const fn cancellation_key(&self) -> Option<&CancelKey>
pub const fn cancellation_key(&self) -> Option<&CancelKey>
Returns the proxy-issued cancellation key for this live session.
Sourcepub fn held_backend_messages(&self) -> HeldBackendMessages<'_>
pub fn held_backend_messages(&self) -> HeldBackendMessages<'_>
Returns an ordered borrowed view of retained backend messages.
Sourcepub fn detach_cancellation(&mut self) -> Option<CancellationRoute>where
K: IntermediaryCancellationRegistry,
pub fn detach_cancellation(&mut self) -> Option<CancellationRoute>where
K: IntermediaryCancellationRegistry,
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,
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,
Sourcepub async fn forward_frontend(
&mut self,
) -> Result<FrontendForwarding, ForwardError<Boundary::Error>>
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.
Sourcepub async fn forward_backend(
&mut self,
) -> Result<BackendForwarding, ForwardError<Boundary::Error>>
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.
Sourcepub async fn flush_backend_hold(
&mut self,
) -> Result<BackendBatchForwarding, ForwardError<Boundary::Error>>
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.
Sourcepub async fn prepare_backend_teardown(
&mut self,
) -> Result<BackendBatchForwarding, ForwardError<Boundary::Error>>
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.
Sourcepub async fn forward_next(
&mut self,
) -> Result<ForwardedMessage, ForwardError<Boundary::Error>>
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.
Sourcepub fn teardown(
self,
) -> (AcceptedServerTransport<DT>, ClientTransport<UT>, State, Boundary, (ServerHandler, ClientHandler), IntermediaryContexts<ServerConnectionContext<Peer, ServerIdentity>, ClientConnectionContext<ClientEvidence>>)
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.