MySQL 8.0.31
Source Code Documentation
resourcegroups::Resource_group Class Reference

Class that represents an abstraction of the Resource Group. More...

#include <resource_group.h>

Public Member Functions

 Resource_group (const std::string &name, const Type type, bool enabled)
 Construct a Resource_group object. More...
 
const std::string & name () const
 
Type type () const
 
bool enabled () const
 
void set_type (Type type)
 
void set_enabled (bool enabled)
 
Thread_resource_controlcontroller ()
 
const Thread_resource_controlcontroller () const
 
bool is_bound_to_threads ()
 Check if resource group is associated with threads. More...
 
bool is_pfs_thread_id_exists (const ulonglong pfs_thread_id)
 Is pfs thread id already exists in the m_pfs_thread_id_map map. More...
 
void add_pfs_thread_id (const ulonglong pfs_thread_id, Resource_group_switch_handler *rg_switch_handler)
 Add pfs_thread_id to the thread id map associated with this resource group. More...
 
void add_or_update_pfs_thread_id (const ulonglong pfs_thread_id, Resource_group_switch_handler *rg_switch_handler)
 Add pfs_thread_id if pfs_thread_id does not exists in the map of threads associated with this thread group. More...
 
void add_temporarily_switched_pfs_thread_id (const ulonglong pfs_thread_id, Resource_group_switch_handler *rg_switch_handler)
 Add pfs_thread_id of a thread which is temporarily switched this resource group. More...
 
Resource_group_switch_handlerresource_group_switch_handler (ulonglong pfs_thread_id)
 Get Resource_group_switch_handler instance for a thread identified by pfs_thread_id from the thread id maps. More...
 
void remove_pfs_thread_id (const ulonglong pfs_thread_id, bool skip_mutex_lock=false)
 Remove the PFS thread id from the thread id maps. More...
 
void clear ()
 Clear the thread id maps associated with this resource group. More...
 
void apply_control_func (std::function< void(ulonglong, Resource_group_switch_handler *)> control_func)
 Apply a control function on threads associated with this resource group. More...
 
 ~Resource_group ()=default
 

Private Member Functions

 Resource_group (const Resource_group &)=delete
 Disable copy construction and assignment. More...
 
void operator= (const Resource_group &)=delete
 

Private Attributes

std::string m_name
 Name of the resource group. More...
 
Type m_type
 Type whether it is user or system resource group. More...
 
bool m_enabled
 bool flag whether resource is enabled or disabled. More...
 
Thread_resource_control m_thread_resource_control
 Thread resource controller object. More...
 
std::map< ulonglong, Resource_group_switch_handler * > m_pfs_thread_id_map
 
std::map< ulonglong, Resource_group_switch_handler * > m_temporarily_switched_pfs_thread_id_map
 
std::mutex m_thread_id_maps_mutex
 Mutex protecting the pfs thread id maps. More...
 

Detailed Description

Class that represents an abstraction of the Resource Group.

It has generic attributes of Resource group name, type, active or inactive, a pointer to a Resource control object.

Constructor & Destructor Documentation

◆ Resource_group() [1/2]

resourcegroups::Resource_group::Resource_group ( const std::string &  name,
const Type  type,
bool  enabled 
)
inline

Construct a Resource_group object.

Parameters
namename of the Resource_group.
typetype of the Resource_group.
enabledCheck if Resource_group is enabled or not.

◆ ~Resource_group()

resourcegroups::Resource_group::~Resource_group ( )
default

◆ Resource_group() [2/2]

resourcegroups::Resource_group::Resource_group ( const Resource_group )
privatedelete

Disable copy construction and assignment.

Member Function Documentation

◆ add_or_update_pfs_thread_id()

void resourcegroups::Resource_group::add_or_update_pfs_thread_id ( const ulonglong  pfs_thread_id,
Resource_group_switch_handler rg_switch_handler 
)
inline

Add pfs_thread_id if pfs_thread_id does not exists in the map of threads associated with this thread group.

Otherwise, update resource group switch handler for the thread_id.

Parameters
pfs_thread_idPFS thread id.
rg_switch_handlerResource_group_switch_handler instance to apply new resource group to a thread on resource group switch from current to some other resource group.

◆ add_pfs_thread_id()

void resourcegroups::Resource_group::add_pfs_thread_id ( const ulonglong  pfs_thread_id,
Resource_group_switch_handler rg_switch_handler 
)
inline

Add pfs_thread_id to the thread id map associated with this resource group.

Parameters
pfs_thread_idPFS thread id.
rg_switch_handlerResource_group_switch_handler instance to apply new resource group to a thread on resource group switch from current to some other resource group.

◆ add_temporarily_switched_pfs_thread_id()

void resourcegroups::Resource_group::add_temporarily_switched_pfs_thread_id ( const ulonglong  pfs_thread_id,
Resource_group_switch_handler rg_switch_handler 
)
inline

Add pfs_thread_id of a thread which is temporarily switched this resource group.

Parameters
pfs_thread_idPFS thread id.
rg_switch_handlerResource_group_switch_handler instance to apply new resource group to a thread on resource group switch from current to some other resource group.

◆ apply_control_func()

void resourcegroups::Resource_group::apply_control_func ( std::function< void(ulonglong, Resource_group_switch_handler *)>  control_func)
inline

Apply a control function on threads associated with this resource group.

Parameters
control_funcpointer to Control function.

◆ clear()

void resourcegroups::Resource_group::clear ( )
inline

Clear the thread id maps associated with this resource group.

◆ controller() [1/2]

Thread_resource_control * resourcegroups::Resource_group::controller ( )
inline

◆ controller() [2/2]

const Thread_resource_control * resourcegroups::Resource_group::controller ( ) const
inline

◆ enabled()

bool resourcegroups::Resource_group::enabled ( ) const
inline

◆ is_bound_to_threads()

bool resourcegroups::Resource_group::is_bound_to_threads ( )
inline

Check if resource group is associated with threads.

Returns
true if some threads are mapped with this resource group else false.

◆ is_pfs_thread_id_exists()

bool resourcegroups::Resource_group::is_pfs_thread_id_exists ( const ulonglong  pfs_thread_id)
inline

Is pfs thread id already exists in the m_pfs_thread_id_map map.

Parameters
pfs_thread_idPFS thread id.
Returns
true if thread id exists in the set else false.

◆ name()

const std::string & resourcegroups::Resource_group::name ( ) const
inline

◆ operator=()

void resourcegroups::Resource_group::operator= ( const Resource_group )
privatedelete

◆ remove_pfs_thread_id()

void resourcegroups::Resource_group::remove_pfs_thread_id ( const ulonglong  pfs_thread_id,
bool  skip_mutex_lock = false 
)
inline

Remove the PFS thread id from the thread id maps.

Parameters
pfs_thread_idRemove pfs thread id.
skip_mutex_lockSkip locking m_thread_id_maps_mutex.

◆ resource_group_switch_handler()

Resource_group_switch_handler * resourcegroups::Resource_group::resource_group_switch_handler ( ulonglong  pfs_thread_id)
inline

Get Resource_group_switch_handler instance for a thread identified by pfs_thread_id from the thread id maps.

Parameters
pfs_thread_idPFS thread id.

◆ set_enabled()

void resourcegroups::Resource_group::set_enabled ( bool  enabled)
inline

◆ set_type()

void resourcegroups::Resource_group::set_type ( Type  type)
inline

◆ type()

Type resourcegroups::Resource_group::type ( ) const
inline

Member Data Documentation

◆ m_enabled

bool resourcegroups::Resource_group::m_enabled
private

bool flag whether resource is enabled or disabled.

◆ m_name

std::string resourcegroups::Resource_group::m_name
private

Name of the resource group.

◆ m_pfs_thread_id_map

std::map<ulonglong, Resource_group_switch_handler *> resourcegroups::Resource_group::m_pfs_thread_id_map
private

◆ m_temporarily_switched_pfs_thread_id_map

std::map<ulonglong, Resource_group_switch_handler *> resourcegroups::Resource_group::m_temporarily_switched_pfs_thread_id_map
private

◆ m_thread_id_maps_mutex

std::mutex resourcegroups::Resource_group::m_thread_id_maps_mutex
private

Mutex protecting the pfs thread id maps.

◆ m_thread_resource_control

Thread_resource_control resourcegroups::Resource_group::m_thread_resource_control
private

Thread resource controller object.

◆ m_type

Type resourcegroups::Resource_group::m_type
private

Type whether it is user or system resource group.


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