MySQL 8.0.37
Source Code Documentation
PooledConnection Class Reference

pooled connection. More...

#include <connection_pool.h>

Inheritance diagram for PooledConnection:
[legend]

Public Types

using Ssl = mysql_harness::Ssl
 

Public Member Functions

 PooledConnection (std::unique_ptr< ConnectionBase > conn)
 
 PooledConnection (std::unique_ptr< ConnectionBase > conn, Ssl ssl)
 
std::unique_ptr< ConnectionBase > & connection ()
 access to conn_. More...
 
const std::unique_ptr< ConnectionBase > & connection () const
 
Sslssl ()
 access to ssl_. More...
 
const Sslssl () const
 
void remover (std::function< void()> remover)
 set a remove-callback. More...
 
void reset ()
 prepares for reusing the connection. More...
 
bool is_authenticated () const
 a pooled connection may be authenticated or not. More...
 
std::string endpoint () const
 

Private Member Functions

void async_idle (std::chrono::milliseconds idle_timeout)
 wait for idle timeout. More...
 
void async_recv_message ()
 wait for server message and shutdown. More...
 
void remove_me ()
 calls remove-callback. More...
 

Private Attributes

std::unique_ptr< ConnectionBaseconn_
 
std::function< void()> remover_
 
Ssl ssl_
 
ConnectionBase::recv_buffer_type recv_buf_
 
net::steady_timer idle_timer_ {conn_->io_ctx()}
 
bool is_authenticated_ {false}
 
std::string endpoint_
 

Friends

class ConnectionPool
 

Detailed Description

pooled connection.

Member Typedef Documentation

◆ Ssl

Constructor & Destructor Documentation

◆ PooledConnection() [1/2]

PooledConnection::PooledConnection ( std::unique_ptr< ConnectionBase conn)
inline

◆ PooledConnection() [2/2]

PooledConnection::PooledConnection ( std::unique_ptr< ConnectionBase conn,
Ssl  ssl 
)
inline

Member Function Documentation

◆ async_idle()

void PooledConnection::async_idle ( std::chrono::milliseconds  idle_timeout)
private

wait for idle timeout.

◆ async_recv_message()

void PooledConnection::async_recv_message ( )
private

wait for server message and shutdown.

◆ connection() [1/2]

std::unique_ptr< ConnectionBase > & PooledConnection::connection ( )
inline

access to conn_.

allows others to move the connection structs out.

◆ connection() [2/2]

const std::unique_ptr< ConnectionBase > & PooledConnection::connection ( ) const
inline

◆ endpoint()

std::string PooledConnection::endpoint ( ) const
inline

◆ is_authenticated()

bool PooledConnection::is_authenticated ( ) const
inline

a pooled connection may be authenticated or not.

not authenticated:

  • connection expects a fresh handshake

authenticated:

  • connection expects a change-user

◆ remove_me()

void PooledConnection::remove_me ( )
private

calls remove-callback.

◆ remover()

void PooledConnection::remover ( std::function< void()>  remover)
inline

set a remove-callback.

used when the pooled connection wants to remove itself from the connection-pool.

◆ reset()

void PooledConnection::reset ( )

prepares for reusing the connection.

◆ ssl() [1/2]

Ssl & PooledConnection::ssl ( )
inline

access to ssl_.

allows others to move the Ssl structs out.

◆ ssl() [2/2]

const Ssl & PooledConnection::ssl ( ) const
inline

Friends And Related Function Documentation

◆ ConnectionPool

friend class ConnectionPool
friend

Member Data Documentation

◆ conn_

std::unique_ptr<ConnectionBase> PooledConnection::conn_
private

◆ endpoint_

std::string PooledConnection::endpoint_
private

◆ idle_timer_

net::steady_timer PooledConnection::idle_timer_ {conn_->io_ctx()}
private

◆ is_authenticated_

bool PooledConnection::is_authenticated_ {false}
private

◆ recv_buf_

ConnectionBase::recv_buffer_type PooledConnection::recv_buf_
private

◆ remover_

std::function<void()> PooledConnection::remover_
private

◆ ssl_

Ssl PooledConnection::ssl_
private

The documentation for this class was generated from the following files: