connection.bak -> connection

This commit is contained in:
Ryan Leckey 2019-11-21 21:40:31 +00:00
parent ec6a3d8021
commit 42c3073089
8 changed files with 18 additions and 18 deletions

View File

@ -21,7 +21,7 @@ use std::{
time::Instant, time::Instant,
}; };
/// A connection.bak to the database. /// A connection to the database.
/// ///
/// This trait is not intended to be used directly. Instead [sqlx::Connection] or [sqlx::Pool] should be used instead, which provide /// This trait is not intended to be used directly. Instead [sqlx::Connection] or [sqlx::Pool] should be used instead, which provide
/// concurrent access and typed retrieval of results. /// concurrent access and typed retrieval of results.
@ -30,20 +30,20 @@ pub trait RawConnection: Send {
// The database backend this type connects to. // The database backend this type connects to.
type Backend: Backend; type Backend: Backend;
/// Establish a new connection.bak to the database server. /// Establish a new connection to the database server.
async fn establish(url: &str) -> crate::Result<Self> async fn establish(url: &str) -> crate::Result<Self>
where where
Self: Sized; Self: Sized;
/// Release resources for this database connection.bak immediately. /// Release resources for this database connection immediately.
/// ///
/// This method is not required to be called. A database server will eventually notice /// This method is not required to be called. A database server will eventually notice
/// and clean up not fully closed connections. /// and clean up not fully closed connections.
/// ///
/// It is safe to close an already closed connection.bak. /// It is safe to close an already closed connection.
async fn close(mut self) -> crate::Result<()>; async fn close(mut self) -> crate::Result<()>;
/// Verifies a connection.bak to the database is still alive. /// Verifies a connection to the database is still alive.
async fn ping(&mut self) -> crate::Result<()> { async fn ping(&mut self) -> crate::Result<()> {
let _ = self let _ = self
.execute( .execute(
@ -115,7 +115,7 @@ where
Ok(Self::new(live, None)) Ok(Self::new(live, None))
} }
/// Verifies a connection.bak to the database is still alive. /// Verifies a connection to the database is still alive.
pub async fn ping(&self) -> crate::Result<()> { pub async fn ping(&self) -> crate::Result<()> {
let mut live = self.0.acquire().await; let mut live = self.0.acquire().await;
live.raw.ping().await?; live.raw.ping().await?;
@ -216,8 +216,8 @@ where
{ {
async fn acquire(&self) -> Live<DB> { async fn acquire(&self) -> Live<DB> {
if let Some(live) = self.live.swap(None) { if let Some(live) = self.live.swap(None) {
// Fast path, this connection.bak is not currently in use. // Fast path, this connection is not currently in use.
// We can directly return the inner connection.bak. // We can directly return the inner connection.
return live; return live;
} }
@ -230,7 +230,7 @@ where
// which would drop this future // which would drop this future
receiver receiver
.await .await
.expect("waiter dropped without dropping connection.bak") .expect("waiter dropped without dropping connection")
} }
fn release(&self, mut live: Live<DB>) { fn release(&self, mut live: Live<DB>) {

View File

@ -16,11 +16,11 @@ pub enum Error {
/// ///
/// - [io::ErrorKind::ConnectionRefused] - Database backend is most likely behind a firewall. /// - [io::ErrorKind::ConnectionRefused] - Database backend is most likely behind a firewall.
/// ///
/// - [io::ErrorKind::ConnectionReset] - Database backend dropped the client connection.bak (perhaps from an administrator action). /// - [io::ErrorKind::ConnectionReset] - Database backend dropped the client connection (perhaps from an administrator action).
/// ///
/// - [io::ErrorKind::InvalidData] - Unexpected or invalid data was encountered. This would indicate that we received data that we were not /// - [io::ErrorKind::InvalidData] - Unexpected or invalid data was encountered. This would indicate that we received data that we were not
/// expecting or it was in a format we did not understand. This generally means either there is a programming error in a SQLx driver or /// expecting or it was in a format we did not understand. This generally means either there is a programming error in a SQLx driver or
/// something with the connection.bak or the database backend itself is corrupted. Additional details are provided along with the /// something with the connection or the database backend itself is corrupted. Additional details are provided along with the
/// error. /// error.
/// ///
Io(io::Error), Io(io::Error),

View File

@ -41,7 +41,7 @@ bitflags::bitflags! {
// Client supports plugin authentication // Client supports plugin authentication
const PLUGIN_AUTH = 1 << 19; const PLUGIN_AUTH = 1 << 19;
// Client send connection.bak attributes // Client send connection attributes
const CONNECT_ATTRS = 1 << 20; const CONNECT_ATTRS = 1 << 20;
// Enable authentication response packet to be larger than 255 bytes // Enable authentication response packet to be larger than 255 bytes

View File

@ -119,7 +119,7 @@ mod test {
10u8, 10u8,
//string<NUL> server version (MariaDB server version is by default prefixed by "5.5.5-") //string<NUL> server version (MariaDB server version is by default prefixed by "5.5.5-")
b"5.5.5-10.4.6-MariaDB-1:10.4.6+maria~bionic\0", b"5.5.5-10.4.6-MariaDB-1:10.4.6+maria~bionic\0",
//int<4> connection.bak id //int<4> connection id
13u8, 0u8, 0u8, 0u8, 13u8, 0u8, 0u8, 0u8,
//string<8> scramble 1st part (authentication seed) //string<8> scramble 1st part (authentication seed)
b"?~~|vZAu", b"?~~|vZAu",

View File

@ -74,7 +74,7 @@ impl<'a> Encode for HandshakeResponsePacket<'a> {
// if (capabilities & CLIENT_CONNECT_ATTRS) // if (capabilities & CLIENT_CONNECT_ATTRS)
if capabilities.contains(Capabilities::CONNECT_ATTRS) { if capabilities.contains(Capabilities::CONNECT_ATTRS) {
// size of connection.bak attributes : int<lenenc> // size of connection attributes : int<lenenc>
buf.put_uint_lenenc::<LittleEndian, _>(self.connection_attrs.len() as u64); buf.put_uint_lenenc::<LittleEndian, _>(self.connection_attrs.len() as u64);
for (key, value) in self.connection_attrs { for (key, value) in self.connection_attrs {

View File

@ -5,7 +5,7 @@ use crate::{
}; };
use byteorder::LittleEndian; use byteorder::LittleEndian;
/// Forces the server to terminate a specified connection.bak. /// Forces the server to terminate a specified connection.
pub struct ComProcessKill { pub struct ComProcessKill {
pub process_id: u32, pub process_id: u32,
} }

View File

@ -4,7 +4,7 @@ use crate::{
mariadb::protocol::{Capabilities, Encode}, mariadb::protocol::{Capabilities, Encode},
}; };
/// Resets a connection.bak without re-authentication. /// Resets a connection without re-authentication.
#[derive(Debug)] #[derive(Debug)]
pub struct ComResetConnection; pub struct ComResetConnection;

View File

@ -2,8 +2,8 @@ use super::Encode;
use crate::io::BufMut; use crate::io::BufMut;
use byteorder::NetworkEndian; use byteorder::NetworkEndian;
/// Sent instead of [`StartupMessage`] with a new connection.bak to cancel a running query on an existing /// Sent instead of [`StartupMessage`] with a new connection to cancel a running query on an existing
/// connection.bak. /// connection.
/// ///
/// https://www.postgresql.org/docs/devel/protocol-flow.html#id-1.10.5.7.9 /// https://www.postgresql.org/docs/devel/protocol-flow.html#id-1.10.5.7.9
pub struct CancelRequest { pub struct CancelRequest {