MySQL 8.0.40
Source Code Documentation
|
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_releaser * | remove (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_releaser * | remove (Cache_element< T > *element) |
Remove an element from some auto releaser down the chain. More... | |
Auto_releaser () | |
Private Attributes | |
Dictionary_client * | m_client |
Object_registry | m_release_registry |
Auto_releaser * | m_prev |
Friends | |
class | Dictionary_client |
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.
|
private |
|
explicit |
Create a new auto releaser and link it into the dictionary client as the current releaser.
client | Dictionary 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.
dd::cache::Dictionary_client::Auto_releaser::~Auto_releaser | ( | ) |
|
inlineprivate |
Register an object to be auto released.
T | Dictionary object type. |
element | Cache element to auto release. |
void dd::cache::Dictionary_client::Auto_releaser::dump | ( | ) | const |
|
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.
T | Dictionary object type. |
element | Cache element to auto remove. |
Dictionary_client::Auto_releaser * dd::cache::Dictionary_client::Auto_releaser::remove | ( | Cache_element< T > * | element | ) |
|
private |
Transfer an object from the current to the previous auto releaser.
T | Dictionary object type. |
object | Dictionary object to transfer. |
|
friend |
|
private |
|
private |
|
private |