![]()  | 
  
    MySQL 8.4.7
    
   Source Code Documentation 
   | 
 
container for connections to MySQL Server. More...
#include <connection_container.h>
Public Types | |
| using | ConnData = MySQLRoutingAPI::ConnData | 
Public Member Functions | |
| std::vector< ConnData > | get_all_connections_info () | 
| void | add_connection (std::shared_ptr< MySQLRoutingConnectionBase > connection) | 
| Adds new connection to container.  More... | |
| unsigned | disconnect (const AllowedNodes &nodes) | 
| Disconnects all connections to servers that are not allowed any longer.  More... | |
| void | disconnect_all () | 
| Disconnects all connection in the ConnectionContainer.  More... | |
| MySQLRoutingConnectionBase * | get_connection (const std::string &client_endpoint) | 
| Retrieve the connection object for the given client endpoint.  More... | |
| void | remove_connection (MySQLRoutingConnectionBase *connection) | 
| removes connection from container  More... | |
| bool | empty () const | 
| check if container is empty.  More... | |
Public Attributes | |
| std::condition_variable | connection_removed_cond_ | 
| number of active client threads.  More... | |
| std::mutex | connection_removed_cond_m_ | 
Private Attributes | |
| concurrent_map< MySQLRoutingConnectionBase *, std::shared_ptr< MySQLRoutingConnectionBase > > | connections_ | 
container for connections to MySQL Server.
When thread of execution for connection to MySQL Server is completed, it should call remove_connection to remove itself from connection container.
| void ConnectionContainer::add_connection | ( | std::shared_ptr< MySQLRoutingConnectionBase > | connection | ) | 
Adds new connection to container.
| connection | The connection to MySQL server | 
| unsigned ConnectionContainer::disconnect | ( | const AllowedNodes & | nodes | ) | 
Disconnects all connections to servers that are not allowed any longer.
| nodes | Allowed servers. Connections to servers that are not in nodes are closed. | 
| void ConnectionContainer::disconnect_all | ( | ) | 
Disconnects all connection in the ConnectionContainer.
      
  | 
  inline | 
check if container is empty.
as the map is concurrent, empty() only gives a reasonable result if it is ensured no other thread is currently adding connections.
      
  | 
  inline | 
| MySQLRoutingConnectionBase * ConnectionContainer::get_connection | ( | const std::string & | client_endpoint | ) | 
Retrieve the connection object for the given client endpoint.
| client_endpoint | The endpoint string | 
| void ConnectionContainer::remove_connection | ( | MySQLRoutingConnectionBase * | connection | ) | 
removes connection from container
This function should be called by thread of execution when connection thread completes. Do NOT call this function before connection's thread of execution completes.
| connection | The connection to remove from container | 
| std::condition_variable ConnectionContainer::connection_removed_cond_ | 
number of active client threads.
| std::mutex ConnectionContainer::connection_removed_cond_m_ | 
      
  | 
  private |