MySQL 9.0.0
Source Code Documentation
dd::cache::Object_registry Class Reference

Object registry containing several maps. More...

#include <object_registry.h>

Classes

struct  Type_selector
 

Public Member Functions

template<typename T >
Multi_map_base< T >::Iterator begin ()
 Get an iterator to the beginning of the local reverse map. More...
 
template<typename T >
Multi_map_base< T >::Iterator end ()
 Get an iterator to one past the end of the local reverse map. More...
 
template<typename K , typename T >
void get (const K &key, Cache_element< T > **element) const
 Get the element corresponding to the given key. More...
 
template<typename T >
void put (Cache_element< T > *element)
 Add a new element to the registry. More...
 
template<typename T >
void remove (Cache_element< T > *element)
 Remove an element from the registry. More...
 
template<typename T >
void erase ()
 Remove and delete all objects of a given type from the registry. More...
 
void erase_all ()
 Remove and delete all objects from the registry. More...
 
template<typename T >
size_t size () const
 Get the number of objects of a given type in the registry. More...
 
size_t size_all () const
 Get the total number of objects in the registry. More...
 
template<typename T >
void dump () const
 Debug dump of the object registry to stderr. More...
 

Private Member Functions

template<class T >
void create_map (std::unique_ptr< T > *map)
 
template<typename T >
T * create_map_if_needed (std::unique_ptr< T > *map)
 Create a map instance unless it exists already. More...
 
Local_multi_map< Abstract_table > * m_map (Type_selector< Abstract_table >)
 Overloaded functions to use for selecting map instance based on a key type. More...
 
const Local_multi_map< Abstract_table > * m_map (Type_selector< Abstract_table >) const
 
Local_multi_map< Charset > * m_map (Type_selector< Charset >)
 
const Local_multi_map< Charset > * m_map (Type_selector< Charset >) const
 
Local_multi_map< Collation > * m_map (Type_selector< Collation >)
 
const Local_multi_map< Collation > * m_map (Type_selector< Collation >) const
 
Local_multi_map< Column_statistics > * m_map (Type_selector< Column_statistics >)
 
const Local_multi_map< Column_statistics > * m_map (Type_selector< Column_statistics >) const
 
Local_multi_map< Event > * m_map (Type_selector< Event >)
 
const Local_multi_map< Event > * m_map (Type_selector< Event >) const
 
Local_multi_map< Resource_group > * m_map (Type_selector< Resource_group >)
 
const Local_multi_map< Resource_group > * m_map (Type_selector< Resource_group >) const
 
Local_multi_map< Routine > * m_map (Type_selector< Routine >)
 
const Local_multi_map< Routine > * m_map (Type_selector< Routine >) const
 
Local_multi_map< Schema > * m_map (Type_selector< Schema >)
 
const Local_multi_map< Schema > * m_map (Type_selector< Schema >) const
 
Local_multi_map< Spatial_reference_system > * m_map (Type_selector< Spatial_reference_system >)
 
const Local_multi_map< Spatial_reference_system > * m_map (Type_selector< Spatial_reference_system >) const
 
Local_multi_map< Tablespace > * m_map (Type_selector< Tablespace >)
 
const Local_multi_map< Tablespace > * m_map (Type_selector< Tablespace >) const
 
template<typename T >
Local_multi_map< T > * m_map ()
 Template function to get a map instance. More...
 
template<typename T >
const Local_multi_map< T > * m_map () const
 

Private Attributes

std::unique_ptr< Local_multi_map< Abstract_table > > m_abstract_table_map
 
std::unique_ptr< Local_multi_map< Charset > > m_charset_map
 
std::unique_ptr< Local_multi_map< Collation > > m_collation_map
 
std::unique_ptr< Local_multi_map< Column_statistics > > m_column_statistics_map
 
std::unique_ptr< Local_multi_map< Event > > m_event_map
 
std::unique_ptr< Local_multi_map< Resource_group > > m_resource_group_map
 
std::unique_ptr< Local_multi_map< Routine > > m_routine_map
 
std::unique_ptr< Local_multi_map< Schema > > m_schema_map
 
std::unique_ptr< Local_multi_map< Spatial_reference_system > > m_spatial_reference_system_map
 
std::unique_ptr< Local_multi_map< Tablespace > > m_tablespace_map
 

Detailed Description

Object registry containing several maps.

The registry is mainly a collection of maps for each type supported. The functions dispatch to the appropriate map based on the key and object type parameter. There is no support for locking or thread synchronization. The object registry is kind of the single threaded version of the shared dictionary cache.

The object registry is intended to be used as a thread local record of which objects have been used.

The individual maps containing DD object pointers are allocated on demand to avoid excessive performance overhead during object instantiation.

Member Function Documentation

◆ begin()

template<typename T >
Multi_map_base< T >::Iterator dd::cache::Object_registry::begin ( void  )
inline

Get an iterator to the beginning of the local reverse map.

The reverse map is guaranteed to contain all elements, that why we use it for iteration. The other maps may not contain all elements since keys may be NULL.

Template Parameters
TDictionary object type.
Returns
Iterator to the beginning of the local reverse map.

◆ create_map()

template<class T >
template void dd::cache::Object_registry::create_map ( std::unique_ptr< T > *  map)
private

◆ create_map_if_needed()

template<typename T >
T * dd::cache::Object_registry::create_map_if_needed ( std::unique_ptr< T > *  map)
inlineprivate

Create a map instance unless it exists already.

◆ dump()

template<typename T >
void dd::cache::Object_registry::dump ( ) const
inline

Debug dump of the object registry to stderr.

Template Parameters
TDictionary object type.

◆ end()

template<typename T >
Multi_map_base< T >::Iterator dd::cache::Object_registry::end ( void  )
inline

Get an iterator to one past the end of the local reverse map.

The reverse map is guaranteed to contain all elements, that why we use it for iteration. The other maps may not contain all elements since keys may be NULL.

Template Parameters
TDictionary object type.
Returns
Iterator to one past the end of the local reverse map.

◆ erase()

template<typename T >
void dd::cache::Object_registry::erase ( )
inline

Remove and delete all objects of a given type from the registry.

Template Parameters
TDictionary object type.

◆ erase_all()

void dd::cache::Object_registry::erase_all ( )
inline

Remove and delete all objects from the registry.

◆ get()

template<typename K , typename T >
void dd::cache::Object_registry::get ( const K &  key,
Cache_element< T > **  element 
) const
inline

Get the element corresponding to the given key.

Note
If the map does not exist, we may as well just set the object pointer to NULL right away since we know that the object will not exist either.
Template Parameters
KKey type.
TDictionary object type.
Parameters
keyKey too lookup.
[out]elementElement, if present, otherwise, NULL.

◆ m_map() [1/22]

template<typename T >
Local_multi_map< T > * dd::cache::Object_registry::m_map ( )
inlineprivate

Template function to get a map instance.

To support generic code, the map instances are available through template function instances. This allows looking up the appropriate instance based on the key type. We must use overloading to accomplish this (see above). Const and non-const variants.

Note
The non-const variant will create a map unless it exists already. The const variant will not create a map, and may thus return a nullptr.
Template Parameters
TDictionary object type.
Returns
The map handling objects of type T.

◆ m_map() [2/22]

template<typename T >
const Local_multi_map< T > * dd::cache::Object_registry::m_map ( ) const
inlineprivate

◆ m_map() [3/22]

Local_multi_map< Abstract_table > * dd::cache::Object_registry::m_map ( Type_selector< Abstract_table )
inlineprivate

Overloaded functions to use for selecting map instance based on a key type.

Const and non-const variants. The non-const variants will create the map unless it exists.

◆ m_map() [4/22]

const Local_multi_map< Abstract_table > * dd::cache::Object_registry::m_map ( Type_selector< Abstract_table ) const
inlineprivate

◆ m_map() [5/22]

Local_multi_map< Charset > * dd::cache::Object_registry::m_map ( Type_selector< Charset )
inlineprivate

◆ m_map() [6/22]

const Local_multi_map< Charset > * dd::cache::Object_registry::m_map ( Type_selector< Charset ) const
inlineprivate

◆ m_map() [7/22]

Local_multi_map< Collation > * dd::cache::Object_registry::m_map ( Type_selector< Collation )
inlineprivate

◆ m_map() [8/22]

const Local_multi_map< Collation > * dd::cache::Object_registry::m_map ( Type_selector< Collation ) const
inlineprivate

◆ m_map() [9/22]

Local_multi_map< Column_statistics > * dd::cache::Object_registry::m_map ( Type_selector< Column_statistics )
inlineprivate

◆ m_map() [10/22]

const Local_multi_map< Column_statistics > * dd::cache::Object_registry::m_map ( Type_selector< Column_statistics ) const
inlineprivate

◆ m_map() [11/22]

Local_multi_map< Event > * dd::cache::Object_registry::m_map ( Type_selector< Event )
inlineprivate

◆ m_map() [12/22]

const Local_multi_map< Event > * dd::cache::Object_registry::m_map ( Type_selector< Event ) const
inlineprivate

◆ m_map() [13/22]

Local_multi_map< Resource_group > * dd::cache::Object_registry::m_map ( Type_selector< Resource_group )
inlineprivate

◆ m_map() [14/22]

const Local_multi_map< Resource_group > * dd::cache::Object_registry::m_map ( Type_selector< Resource_group ) const
inlineprivate

◆ m_map() [15/22]

Local_multi_map< Routine > * dd::cache::Object_registry::m_map ( Type_selector< Routine )
inlineprivate

◆ m_map() [16/22]

const Local_multi_map< Routine > * dd::cache::Object_registry::m_map ( Type_selector< Routine ) const
inlineprivate

◆ m_map() [17/22]

Local_multi_map< Schema > * dd::cache::Object_registry::m_map ( Type_selector< Schema )
inlineprivate

◆ m_map() [18/22]

const Local_multi_map< Schema > * dd::cache::Object_registry::m_map ( Type_selector< Schema ) const
inlineprivate

◆ m_map() [19/22]

Local_multi_map< Spatial_reference_system > * dd::cache::Object_registry::m_map ( Type_selector< Spatial_reference_system )
inlineprivate

◆ m_map() [20/22]

const Local_multi_map< Spatial_reference_system > * dd::cache::Object_registry::m_map ( Type_selector< Spatial_reference_system ) const
inlineprivate

◆ m_map() [21/22]

Local_multi_map< Tablespace > * dd::cache::Object_registry::m_map ( Type_selector< Tablespace )
inlineprivate

◆ m_map() [22/22]

const Local_multi_map< Tablespace > * dd::cache::Object_registry::m_map ( Type_selector< Tablespace ) const
inlineprivate

◆ put()

template<typename T >
void dd::cache::Object_registry::put ( Cache_element< T > *  element)
inline

Add a new element to the registry.

Template Parameters
TDictionary object type.
Parameters
elementElement to be added.

◆ remove()

template<typename T >
void dd::cache::Object_registry::remove ( Cache_element< T > *  element)
inline

Remove an element from the registry.

Template Parameters
TDictionary object type.
Parameters
elementElement to be removed.

◆ size()

template<typename T >
size_t dd::cache::Object_registry::size ( ) const
inline

Get the number of objects of a given type in the registry.

Template Parameters
TDictionary object type.
Returns
Number of objects.

◆ size_all()

size_t dd::cache::Object_registry::size_all ( ) const
inline

Get the total number of objects in the registry.

Returns
Number of objects.

Member Data Documentation

◆ m_abstract_table_map

std::unique_ptr<Local_multi_map<Abstract_table> > dd::cache::Object_registry::m_abstract_table_map
private

◆ m_charset_map

std::unique_ptr<Local_multi_map<Charset> > dd::cache::Object_registry::m_charset_map
private

◆ m_collation_map

std::unique_ptr<Local_multi_map<Collation> > dd::cache::Object_registry::m_collation_map
private

◆ m_column_statistics_map

std::unique_ptr<Local_multi_map<Column_statistics> > dd::cache::Object_registry::m_column_statistics_map
private

◆ m_event_map

std::unique_ptr<Local_multi_map<Event> > dd::cache::Object_registry::m_event_map
private

◆ m_resource_group_map

std::unique_ptr<Local_multi_map<Resource_group> > dd::cache::Object_registry::m_resource_group_map
private

◆ m_routine_map

std::unique_ptr<Local_multi_map<Routine> > dd::cache::Object_registry::m_routine_map
private

◆ m_schema_map

std::unique_ptr<Local_multi_map<Schema> > dd::cache::Object_registry::m_schema_map
private

◆ m_spatial_reference_system_map

std::unique_ptr<Local_multi_map<Spatial_reference_system> > dd::cache::Object_registry::m_spatial_reference_system_map
private

◆ m_tablespace_map

std::unique_ptr<Local_multi_map<Tablespace> > dd::cache::Object_registry::m_tablespace_map
private

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