26#ifndef ROUTING_CONNECTION_CONTAINER_INCLUDED 
   27#define ROUTING_CONNECTION_CONTAINER_INCLUDED 
   49template <
typename Key, 
typename Value, 
typename Hash = std::hash<Key>>
 
   58                 const Hash &hasher = Hash())
 
   64  template <
typename Predicate>
 
   69  template <
typename Predicate>
 
   72      each_bucket.for_each(
p);
 
   85      result += each_bucket.size();
 
   91    for (
const auto &each_bucket : 
buckets_) {
 
   92      if (!each_bucket.empty()) 
return false;
 
  112    template <
typename Predicate>
 
  116      if (found != 
data_.end()) 
p(found->second);
 
  119    template <
typename Predicate>
 
  132      return data_.empty();
 
  166                 std::shared_ptr<MySQLRoutingConnectionBase>>
 
  173    std::vector<ConnData> connection_datas;
 
  177          const auto stats = conn.second->get_stats();
 
  179          connection_datas.emplace_back(
 
  182              stats.last_sent_to_server, 
stats.last_received_from_server);
 
  185    return connection_datas;
 
  192  void add_connection(std::shared_ptr<MySQLRoutingConnectionBase> connection);
 
  216      const std::string &client_endpoint);
 
  231          &affected_routing_sources);
 
container for connections to MySQL Server.
Definition: connection_container.h:164
 
void disconnect_all()
Disconnects all connection in the ConnectionContainer.
Definition: connection_container.cc:140
 
void disconnect_on_routing_guidelines_update(const routing_guidelines::Routing_guidelines_engine::RouteChanges &affected_routing_sources)
Definition: connection_container.cc:154
 
std::vector< ConnData > get_all_connections_info()
Definition: connection_container.h:172
 
bool empty() const
check if container is empty.
Definition: connection_container.h:243
 
unsigned disconnect(const AllowedNodes &nodes)
Disconnects all connections to servers that are not allowed any longer.
Definition: connection_container.cc:55
 
std::mutex connection_removed_cond_m_
Definition: connection_container.h:235
 
std::condition_variable connection_removed_cond_
number of active client threads.
Definition: connection_container.h:234
 
MySQLRoutingConnectionBase * get_connection(const std::string &client_endpoint)
Retrieve the connection object for the given client endpoint.
Definition: connection_container.cc:123
 
void add_connection(std::shared_ptr< MySQLRoutingConnectionBase > connection)
Adds new connection to container.
Definition: connection_container.cc:33
 
void remove_connection(MySQLRoutingConnectionBase *connection)
removes connection from container
Definition: connection_container.cc:145
 
concurrent_map< MySQLRoutingConnectionBase *, std::shared_ptr< MySQLRoutingConnectionBase > > connections_
Definition: connection_container.h:167
 
Definition: connection.h:47
 
Definition: connection_container.h:100
 
std::mutex data_mutex_
Definition: connection_container.h:141
 
std::size_t size() const
Definition: connection_container.h:125
 
void for_each(Predicate &p)
Definition: connection_container.h:120
 
BucketData data_
Definition: connection_container.h:140
 
typename BucketData::iterator BucketIterator
Definition: connection_container.h:137
 
void put(const Key &key, Value &&value)
Definition: connection_container.h:102
 
std::map< Key, Value > BucketData
Definition: connection_container.h:136
 
typename BucketData::const_iterator ConstBucketIterator
Definition: connection_container.h:138
 
void for_one(const Key &key, Predicate &p)
Definition: connection_container.h:113
 
void erase(const Key &key)
Definition: connection_container.h:107
 
bool empty() const
Definition: connection_container.h:130
 
Basic Concurrent Map.
Definition: connection_container.h:50
 
concurrent_map(const concurrent_map &other)=delete
 
concurrent_map(unsigned num_buckets=kDefaultNumberOfBucket, const Hash &hasher=Hash())
Definition: connection_container.h:57
 
void erase(const Key &key)
Definition: connection_container.h:80
 
std::size_t size() const
Definition: connection_container.h:82
 
Bucket & get_bucket(const Key &key)
Definition: connection_container.h:147
 
static const unsigned kDefaultNumberOfBucket
Definition: connection_container.h:98
 
Value mapped_type
Definition: connection_container.h:53
 
void for_each(Predicate p)
Definition: connection_container.h:70
 
void for_one(const Key &key, Predicate &p)
Definition: connection_container.h:65
 
concurrent_map & operator=(const concurrent_map &other)=delete
 
Hash hasher_
Definition: connection_container.h:145
 
void put(const Key &key, Value &&value)
Definition: connection_container.h:76
 
const Bucket & get_bucket(const Key &key) const
Definition: connection_container.h:152
 
bool empty() const
Definition: connection_container.h:90
 
Hash hash_type
Definition: connection_container.h:54
 
typename std::map< Key, Value >::value_type value_type
Definition: connection_container.h:55
 
std::vector< Bucket > buckets_
Definition: connection_container.h:144
 
Key key_type
Definition: connection_container.h:52
 
const char * p
Definition: ctype-mb.cc:1227
 
std::vector< AvailableDestination > AllowedNodes
Definition: destination_status_types.h:62
 
void for_each(const Shards< COUNT > &shards, Function &&f) noexcept
Iterate over the shards.
Definition: ut0counter.h:323
 
uint16_t value_type
Definition: vt100.h:184
 
std::string_view Key
The key type for the hash structure in HashJoinRowBuffer.
Definition: hash_join_buffer.h:108
 
ValueType value(const std::optional< ValueType > &v)
Definition: gtid.h:83
 
static std::mutex lock
Definition: net_ns.cc:56
 
struct result result
Definition: result.h:34
 
required string key
Definition: replication_asynchronous_connection_failover.proto:60
 
Definition: routing_component.h:74
 
A filter of some sort that is not a join condition (those are stored in JoinPredicate objects).
Definition: access_path.h:133
 
Type for names of Routes changed during routing guidelines document update.
Definition: routing_guidelines.h:324
 
Definition: mysqlslap.cc:243