MySQL 8.0.40
Source Code Documentation
Mutexed_map_thd_srv_session Class Reference

std::map of THD* as key and Srv_session* as value guarded by a read-write lock. More...

Classes

class  Do_Impl
 

Public Member Functions

bool init ()
 Initializes the map. More...
 
bool deinit ()
 Deinitializes the map. More...
 
Srv_sessionfind (const THD *key)
 Searches for an element with in the map. More...
 
bool add (const THD *key, const void *plugin, Srv_session *session)
 Add an element to the map. More...
 
bool remove (const THD *key)
 Removes an element from the map. More...
 
void remove_all_of_plugin (const void *plugin, unsigned int &removed)
 Removes all elements which have been added with plugin as plugin name. More...
 
bool clear ()
 Empties the map. More...
 
unsigned int size ()
 Returns the number of elements in the maps. More...
 

Private Types

typedef std::pair< const void *, Srv_session * > map_value_t
 

Private Attributes

std::map< const THD *, map_value_tcollection
 
bool initted
 
bool psi_initted
 
mysql_rwlock_t LOCK_collection
 
PSI_rwlock_key key_LOCK_collection
 

Detailed Description

std::map of THD* as key and Srv_session* as value guarded by a read-write lock.

RW lock is used instead of a mutex, as find() is a hot spot due to the sanity checks it is used for - when a pointer to a closed session is passed.

Member Typedef Documentation

◆ map_value_t

typedef std::pair<const void *, Srv_session *> Mutexed_map_thd_srv_session::map_value_t
private

Member Function Documentation

◆ add()

bool Mutexed_map_thd_srv_session::add ( const THD key,
const void *  plugin,
Srv_session session 
)
inline

Add an element to the map.

Parameters
keykey
pluginsecondary key
sessionobject to be added to the collection
Return values
falsesuccess
truefailure

◆ clear()

bool Mutexed_map_thd_srv_session::clear ( )
inline

Empties the map.

Returns
false success true failure

◆ deinit()

bool Mutexed_map_thd_srv_session::deinit ( void  )
inline

Deinitializes the map.

Returns
false success true failure

◆ find()

Srv_session * Mutexed_map_thd_srv_session::find ( const THD key)
inline

Searches for an element with in the map.

Parameters
keyKey of the element
Returns
value of the element
Return values
NULLif not found

◆ init()

bool Mutexed_map_thd_srv_session::init ( void  )
inline

Initializes the map.

Returns
false success true failure

◆ remove()

bool Mutexed_map_thd_srv_session::remove ( const THD key)
inline

Removes an element from the map.

Parameters
keykey
Returns
false success true failure

◆ remove_all_of_plugin()

void Mutexed_map_thd_srv_session::remove_all_of_plugin ( const void *  plugin,
unsigned int &  removed 
)
inline

Removes all elements which have been added with plugin as plugin name.

Parameters
pluginkey
removedOUT Number of removed elements

◆ size()

unsigned int Mutexed_map_thd_srv_session::size ( )
inline

Returns the number of elements in the maps.

Member Data Documentation

◆ collection

std::map<const THD *, map_value_t> Mutexed_map_thd_srv_session::collection
private

◆ initted

bool Mutexed_map_thd_srv_session::initted
private

◆ key_LOCK_collection

PSI_rwlock_key Mutexed_map_thd_srv_session::key_LOCK_collection
private

◆ LOCK_collection

mysql_rwlock_t Mutexed_map_thd_srv_session::LOCK_collection
private

◆ psi_initted

bool Mutexed_map_thd_srv_session::psi_initted
private

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