MySQL 9.2.0
Source Code Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
connection_control::Connection_event_coordinator Class Reference

Connection event coordinator. More...

#include <connection_control_coordinator.h>

Inheritance diagram for connection_control::Connection_event_coordinator:
[legend]

Public Member Functions

 Connection_event_coordinator ()
 
void notify_event (MYSQL_THD thd, const mysql_event_tracking_connection_data *connection_event)
 Handle connection event. More...
 
void notify_sys_var (opt_connection_control variable, void *new_value)
 Process change in sys_var value. More...
 
bool register_event_subscriber (Connection_event_observer **subscriber, std::vector< opt_connection_control, CustomAllocator< opt_connection_control > > *sys_vars, std::vector< stats_connection_control, CustomAllocator< stats_connection_control > > *status_vars)
 Register an event subscriber. More...
 
bool notify_status_var (Connection_event_observer **observer, stats_connection_control status_var, status_var_action action)
 Update a status variable. More...
 

Private Member Functions

void reset ()
 Reset Connection_event_coordinator information. More...
 

Private Attributes

std::vector< Connection_event_subscriber, CustomAllocator< Connection_event_subscriber > > m_subscribers
 
Connection_event_observerm_status_vars_subscription [STAT_LAST]
 

Additional Inherited Members

- Static Public Member Functions inherited from connection_control::Connection_control_alloc
static void * operator new (size_t size) noexcept
 
static void * operator new[] (size_t size) noexcept
 
static void operator delete (void *ptr)
 
static void operator delete[] (void *ptr)
 

Detailed Description

Connection event coordinator.

This class will keep list of subscribers for different subevents and notify them based on their preference.

Constructor & Destructor Documentation

◆ Connection_event_coordinator()

connection_control::Connection_event_coordinator::Connection_event_coordinator ( )
inline

Member Function Documentation

◆ notify_event()

void connection_control::Connection_event_coordinator::notify_event ( MYSQL_THD  thd,
const mysql_event_tracking_connection_data connection_event 
)

Handle connection event.

When a notification from server is received, perform following: Iterate through list of subscribers If a subscriber has shown interest in received event, call notify() for the subscriber

Note : If we receive error from a subscriber, we log it and move on.

Parameters
[in]thdTHD handle
[in]connection_eventEvent information

◆ notify_status_var()

bool connection_control::Connection_event_coordinator::notify_status_var ( Connection_event_observer **  observer,
stats_connection_control  status_var,
status_var_action  action 
)

Update a status variable.

Parameters
[in]observerRequestor
[in]status_varStatus variable to be updated
[in]actionOperation to be performed on status variable
Returns
status of the operation
Return values
falseSuccess
trueError in processing

◆ notify_sys_var()

void connection_control::Connection_event_coordinator::notify_sys_var ( opt_connection_control  variable,
void *  new_value 
)

Process change in sys_var value.

Iterate through all subscribers

  • If a subscriber has shown interest in getting notification for given system variable, call notify_sys_var.

Note : If we receive error from a subscriber, we log it and move on.

Parameters
[in]variableVariable information
[in]new_valueNew value for variable

◆ register_event_subscriber()

bool connection_control::Connection_event_coordinator::register_event_subscriber ( Connection_event_observer **  subscriber,
std::vector< opt_connection_control, CustomAllocator< opt_connection_control > > *  sys_vars,
std::vector< stats_connection_control, CustomAllocator< stats_connection_control > > *  status_vars 
)

Register an event subscriber.

A subscriber can provide following preferences:

  1. Set of events for which subscriber is interested
  2. Set of variables for which subscriber would like to receive update
  3. Set of stats for which subscriber would like to send update
Parameters
[in]subscriberHandle to Connection_event_observers
[in]sys_varsopt_connection_control vector
[in]status_varsstats_connection_control vector
Returns
subscription status
Return values
falseSubscription successful
trueFailure in subscription for given combination of prefernece. Most probably, other subscriber has already subscribed for status var update.

◆ reset()

void connection_control::Connection_event_coordinator::reset ( )
private

Reset Connection_event_coordinator information.

Member Data Documentation

◆ m_status_vars_subscription

Connection_event_observer* connection_control::Connection_event_coordinator::m_status_vars_subscription[STAT_LAST]
private

◆ m_subscribers

std::vector<Connection_event_subscriber, CustomAllocator<Connection_event_subscriber> > connection_control::Connection_event_coordinator::m_subscribers
private

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