MySQL 9.1.0
Source Code Documentation
|
EventStateTracker singleton object keeps track of the current known state of selected event. More...
#include <event_state_tracker.h>
Public Types | |
enum class | EventId : size_t { MetadataServerConnectedOk , MetadataRefreshOk , GRMemberConnectedOk , MetadataNodeInGR , GRNodeInMetadata , TargetClusterPresentInOptions , ClusterInvalidatedInMetadata , ClusterWasBootstrappedAgainstClusterset , NoRightsToUpdateRouterAttributes , NoGRQuorum } |
List of the events that can currently be tracked. More... | |
Public Member Functions | |
bool | state_changed (const int state, const EventId event_id, const std::string &additional_tag="") |
Returns information about the selected event state change (and sets the new state of event if changed). More... | |
void | remove_tag (const std::string &tag) |
Remove the state for a given tag for all event_id that it has registered. More... | |
void | clear () |
Remove stored state for all events. More... | |
Static Public Member Functions | |
static EventStateTracker & | instance () |
Get the singleton object of EventStateTracker. More... | |
Private Types | |
using | Key = std::pair< size_t, size_t > |
Private Member Functions | |
EventStateTracker ()=default | |
EventStateTracker (const EventStateTracker &)=delete | |
EventStateTracker | operator= (const EventStateTracker &)=delete |
Private Attributes | |
std::map< Key, int > | events_ |
std::mutex | events_mtx_ |
EventStateTracker singleton object keeps track of the current known state of selected event.
Can be used to track the changes of the state of selected event (for conditional logging etc.)
|
private |
|
strong |
List of the events that can currently be tracked.
|
privatedefault |
|
privatedelete |
void mysql_harness::EventStateTracker::clear | ( | ) |
Remove stored state for all events.
|
static |
Get the singleton object of EventStateTracker.
|
privatedelete |
void mysql_harness::EventStateTracker::remove_tag | ( | const std::string & | tag | ) |
Remove the state for a given tag for all event_id that it has registered.
tag | tag of the events being removed |
bool mysql_harness::EventStateTracker::state_changed | ( | const int | state, |
const EventId | event_id, | ||
const std::string & | additional_tag = "" |
||
) |
Returns information about the selected event state change (and sets the new state of event if changed).
state | current state of the event |
event_id | id of the event |
additional_tag | optional tag |
true | the event state has changed since the last call |
false | the event state has NOT changed since the last call |
|
private |
|
private |