MySQL 8.0.40
Source Code Documentation
dd::cache::Dictionary_client::Auto_releaser Class Reference

Class to help releasing and deleting objects. More...

#include <dictionary_client.h>

Public Member Functions

 Auto_releaser (Dictionary_client *client)
 Create a new auto releaser and link it into the dictionary client as the current releaser. More...
 
 ~Auto_releaser ()
 
template<typename T >
void dump () const
 
template<typename T >
Dictionary_client::Auto_releaserremove (Cache_element< T > *element)
 

Private Member Functions

template<typename T >
void auto_release (Cache_element< T > *element)
 Register an object to be auto released. More...
 
template<typename T >
void transfer_release (const T *object)
 Transfer an object from the current to the previous auto releaser. More...
 
template<typename T >
Auto_releaserremove (Cache_element< T > *element)
 Remove an element from some auto releaser down the chain. More...
 
 Auto_releaser ()
 

Private Attributes

Dictionary_clientm_client
 
Object_registry m_release_registry
 
Auto_releaserm_prev
 

Friends

class Dictionary_client
 

Detailed Description

Class to help releasing and deleting objects.

This class keeps a register of shared objects that are automatically released when the instance goes out of scope. When a new instance is created, the encompassing dictionary client's current auto releaser is replaced by this one, keeping a link to the old one. When the auto releaser is deleted, it links the old releaser back in as the client's current releaser.

Shared objects that are added to the auto releaser will be released when the releaser is deleted. Only the dictionary client is allowed to add objects to the auto releaser.

The usage pattern is that objects that are retrieved from the shared dictionary cache are added to the current auto releaser. Objects that are retrieved from the client's local object register are not added to the auto releaser. Thus, when the releaser is deleted, it releases all objects that have been retrieved from the shared cache during the lifetime of the releaser.

Similarly the auto releaser maintains a list of objects created by acquire_uncached(). These objects are owned by the Auto_releaser and are deleted when the auto releaser goes out of scope.

Constructor & Destructor Documentation

◆ Auto_releaser() [1/2]

dd::cache::Dictionary_client::Auto_releaser::Auto_releaser ( )
private

◆ Auto_releaser() [2/2]

dd::cache::Dictionary_client::Auto_releaser::Auto_releaser ( Dictionary_client client)
explicit

Create a new auto releaser and link it into the dictionary client as the current releaser.

Parameters
clientDictionary client for which to install this auto releaser.

Make sure that if we install a first auto_releaser, we do not have uncommitted object or we are not processing a transactional DDL.

◆ ~Auto_releaser()

dd::cache::Dictionary_client::Auto_releaser::~Auto_releaser ( )

Member Function Documentation

◆ auto_release()

template<typename T >
void dd::cache::Dictionary_client::Auto_releaser::auto_release ( Cache_element< T > *  element)
inlineprivate

Register an object to be auto released.

Template Parameters
TDictionary object type.
Parameters
elementCache element to auto release.

◆ dump()

template<typename T >
void dd::cache::Dictionary_client::Auto_releaser::dump ( ) const

◆ remove() [1/2]

template<typename T >
Auto_releaser * dd::cache::Dictionary_client::Auto_releaser::remove ( Cache_element< T > *  element)
private

Remove an element from some auto releaser down the chain.

Return a pointer to the releaser where the element was found. Thus, the element may be re-inserted into the appropriate auto releaser after e.g. changing the keys.

Template Parameters
TDictionary object type.
Parameters
elementCache element to auto remove.
Returns
Pointer to the auto releaser where the object was signed up.

◆ remove() [2/2]

template<typename T >
Dictionary_client::Auto_releaser * dd::cache::Dictionary_client::Auto_releaser::remove ( Cache_element< T > *  element)

◆ transfer_release()

template<typename T >
void dd::cache::Dictionary_client::Auto_releaser::transfer_release ( const T *  object)
private

Transfer an object from the current to the previous auto releaser.

Template Parameters
TDictionary object type.
Parameters
objectDictionary object to transfer.

Friends And Related Function Documentation

◆ Dictionary_client

friend class Dictionary_client
friend

Member Data Documentation

◆ m_client

Dictionary_client* dd::cache::Dictionary_client::Auto_releaser::m_client
private

◆ m_prev

Auto_releaser* dd::cache::Dictionary_client::Auto_releaser::m_prev
private

◆ m_release_registry

Object_registry dd::cache::Dictionary_client::Auto_releaser::m_release_registry
private

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