26#ifndef ROUTING_CONNECTION_CONTAINER_INCLUDED 
   27#define ROUTING_CONNECTION_CONTAINER_INCLUDED 
   52template <
typename Key, 
typename Value, 
typename Hash = std::hash<Key>>
 
   67  template <
typename Predicate>
 
   72  template <
typename Predicate>
 
   75      each_bucket.for_each(
p);
 
   88      result += each_bucket.size();
 
   94    for (
const auto &each_bucket : 
buckets_) {
 
   95      if (!each_bucket.empty()) 
return false;
 
  107      data_.emplace(
key, std::move(value));
 
  115    template <
typename Predicate>
 
  119      if (found != 
data_.end()) 
p(found->second);
 
  122    template <
typename Predicate>
 
  135      return data_.empty();
 
  169                 std::shared_ptr<MySQLRoutingConnectionBase>>
 
  176    std::vector<ConnData> connection_datas;
 
  180          const auto stats = conn.second->get_stats();
 
  182          connection_datas.emplace_back(
 
  185              stats.last_sent_to_server, 
stats.last_received_from_server);
 
  188    return connection_datas;
 
  195  void add_connection(std::shared_ptr<MySQLRoutingConnectionBase> connection);
 
  219      const std::string &client_endpoint);
 
container for connections to MySQL Server.
Definition: connection_container.h:167
 
void disconnect_all()
Disconnects all connection in the ConnectionContainer.
Definition: connection_container.cc:140
 
std::vector< ConnData > get_all_connections_info()
Definition: connection_container.h:175
 
bool empty() const
check if container is empty.
Definition: connection_container.h:242
 
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:234
 
std::condition_variable connection_removed_cond_
number of active client threads.
Definition: connection_container.h:233
 
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:170
 
Definition: connection.h:44
 
Definition: connection_container.h:103
 
std::mutex data_mutex_
Definition: connection_container.h:144
 
std::size_t size() const
Definition: connection_container.h:128
 
void for_each(Predicate &p)
Definition: connection_container.h:123
 
BucketData data_
Definition: connection_container.h:143
 
typename BucketData::iterator BucketIterator
Definition: connection_container.h:140
 
void put(const Key &key, Value &&value)
Definition: connection_container.h:105
 
std::map< Key, Value > BucketData
Definition: connection_container.h:139
 
typename BucketData::const_iterator ConstBucketIterator
Definition: connection_container.h:141
 
void for_one(const Key &key, Predicate &p)
Definition: connection_container.h:116
 
void erase(const Key &key)
Definition: connection_container.h:110
 
bool empty() const
Definition: connection_container.h:133
 
Basic Concurrent Map.
Definition: connection_container.h:53
 
concurrent_map(const concurrent_map &other)=delete
 
concurrent_map(unsigned num_buckets=kDefaultNumberOfBucket, const Hash &hasher=Hash())
Definition: connection_container.h:60
 
void erase(const Key &key)
Definition: connection_container.h:83
 
std::size_t size() const
Definition: connection_container.h:85
 
Bucket & get_bucket(const Key &key)
Definition: connection_container.h:150
 
static const unsigned kDefaultNumberOfBucket
Definition: connection_container.h:101
 
Value mapped_type
Definition: connection_container.h:56
 
void for_each(Predicate p)
Definition: connection_container.h:73
 
void for_one(const Key &key, Predicate &p)
Definition: connection_container.h:68
 
concurrent_map & operator=(const concurrent_map &other)=delete
 
Hash hasher_
Definition: connection_container.h:148
 
void put(const Key &key, Value &&value)
Definition: connection_container.h:79
 
const Bucket & get_bucket(const Key &key) const
Definition: connection_container.h:155
 
bool empty() const
Definition: connection_container.h:93
 
Hash hash_type
Definition: connection_container.h:57
 
typename std::map< Key, Value >::value_type value_type
Definition: connection_container.h:58
 
std::vector< Bucket > buckets_
Definition: connection_container.h:147
 
Key key_type
Definition: connection_container.h:55
 
const char * p
Definition: ctype-mb.cc:1235
 
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::unordered_map< Key, CHARSET_INFO * > Hash
Definition: collations_internal.cc:548
 
std::string_view Key
The key type for the hash structure in HashJoinRowBuffer.
Definition: hash_join_buffer.h:102
 
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:73
 
A filter of some sort that is not a join condition (those are stored in JoinPredicate objects).
Definition: access_path.h:132
 
Definition: mysqlslap.cc:240