pub struct Connection { /* private fields */ }Implementations§
Source§impl Connection
impl Connection
pub fn new(config: Config) -> Result<Self>
pub fn output(&self) -> &[u8] ⓘ
pub fn consume_output(&mut self, n: usize) -> Result<()>
pub fn receive(&mut self, bytes: &[u8]) -> Result<()>
Sourcepub fn tls_established(&mut self) -> Result<()>
pub fn tls_established(&mut self) -> Result<()>
Acknowledge TLS without channel-binding data (plain SCRAM fallback).
Sourcepub fn tls_established_with_channel_binding(
&mut self,
available: bool,
) -> Result<()>
pub fn tls_established_with_channel_binding( &mut self, available: bool, ) -> Result<()>
Acknowledge verified TLS and whether the host can supply tls-server-end-point
data to start_scram. The core prefers PLUS only when data is available.
pub fn start_scram(&mut self, scram: ScramSha256) -> Result<()>
pub fn query( &mut self, token: Token, sql: &str, deadline: Option<Instant>, ) -> Result<()>
Sourcepub fn execute(
&mut self,
token: Token,
query: ExtendedQuery<'_>,
deadline: Option<Instant>,
) -> Result<()>
pub fn execute( &mut self, token: Token, query: ExtendedQuery<'_>, deadline: Option<Instant>, ) -> Result<()>
Every operation ends in Sync, so an error cannot discard a later token.
pub fn copy_data(&mut self, bytes: &[u8]) -> Result<()>
pub fn copy_finish(&mut self, error: Option<&str>) -> Result<()>
Sourcepub fn cancel_request(&self) -> Option<[u8; 16]>
pub fn cancel_request(&self) -> Option<[u8; 16]>
Send on a NEW connection; the main stream remains owned by this state machine.
pub fn transaction_status(&self) -> TransactionStatus
pub fn is_ready(&self) -> bool
pub fn pending_count(&self) -> usize
pub fn next_timeout(&self) -> Option<Instant>
pub fn handle_timeout(&mut self, now: Instant)
Sourcepub fn abort(&mut self, reason: Error)
pub fn abort(&mut self, reason: Error)
Transport EOF, TLS failure, cancellation or malformed input terminates all pending tokens once. Pull Completed events followed by Closed.
pub fn end(&mut self) -> Result<()>
Sourcepub fn next_event(&mut self) -> Result<Option<Event<'_>>>
pub fn next_event(&mut self) -> Result<Option<Event<'_>>>
Pull the next borrowed event. A terminal server ErrorResponse returns
Error::ConnectionAborted immediately and makes the session unusable.
Continue pulling to drain one Aborted completion per pending token, then
Closed; a later transport abort cannot replace the server diagnostic.