24#ifndef AUTH_UTILITY_INCLUDED
25#define AUTH_UTILITY_INCLUDED
35template <
typename K,
typename V>
60 const auto search_itr =
m_map.find(
key);
61 if (search_itr !=
m_map.end()) {
62 value = search_itr->second;
80 auto returns =
m_map.insert(std::make_pair(
key, value));
81 return returns.second;
Map with RWLock protections.
Definition: auth_utility.h:36
size_t size()
Get the size of the map.
Definition: auth_utility.h:105
Map_with_rw_lock(const Map_with_rw_lock &)=delete
~Map_with_rw_lock()
Definition: auth_utility.h:43
void clear_if_greater(size_t size)
Check limit and clear if needed.
Definition: auth_utility.h:99
void erase(K key)
Delete an entry.
Definition: auth_utility.h:89
mysql_rwlock_t m_lock
Lock to protect m_map.
Definition: auth_utility.h:114
Map_with_rw_lock & operator=(Map_with_rw_lock &&)=delete
std::map< K, V > m_map
Map.
Definition: auth_utility.h:112
Map_with_rw_lock(PSI_rwlock_key key)
Definition: auth_utility.h:38
Map_with_rw_lock & operator=(const Map_with_rw_lock &)=delete
bool find(const K &key, V &value)
Search an entry.
Definition: auth_utility.h:58
Map_with_rw_lock(Map_with_rw_lock &&)=delete
bool insert(K key, V value)
Insert an entry.
Definition: auth_utility.h:78
Locks RW-lock and releases lock on scope exit.
Definition: rwlock_scoped_lock.h:31
#define mysql_rwlock_init(K, T)
Definition: mysql_rwlock.h:40
#define mysql_rwlock_destroy(T)
Definition: mysql_rwlock.h:50
unsigned int PSI_rwlock_key
Instrumented rwlock key.
Definition: psi_rwlock_bits.h:43
Instrumentation helpers for rwlock.
required string key
Definition: replication_asynchronous_connection_failover.proto:59
An instrumented rwlock structure.
Definition: mysql_rwlock_bits.h:50