MySQL 8.0.29
Source Code Documentation
mysql_harness::PluginFuncEnv Class Reference

PluginFuncEnv object. More...

#include <loader.h>

Public Member Functions

 PluginFuncEnv (const AppInfo *info, const ConfigSection *section, bool running=false)
 Constructor. More...
 
const ConfigSectionget_config_section () const noexcept
 
const AppInfo * get_app_info () const noexcept
 
void set_running () noexcept
 
void clear_running () noexcept
 
bool is_running () const noexcept
 
bool wait_for_stop (uint32_t milliseconds) const noexcept
 
bool exit_ok () const noexcept
 
void set_error (ErrorType error_type, const char *fmt, va_list ap) noexcept
 
std::tuple< std::string, std::exception_ptr > pop_error () noexcept
 

Private Attributes

const AppInfo * app_info_
 
const ConfigSectionconfig_section_
 
bool running_
 
std::string error_message_
 
ErrorType error_type_ = kNoError
 
std::condition_variable cond_
 
std::mutex mutex_
 

Detailed Description

PluginFuncEnv object.

This object is the basis of all communication between Harness and plugin functions. It is passed to plugin functions (as an opaque pointer), and plugin functions return it back to Harness when calling Harness API functions. It has several functions:

  • maintains a "running" flag, which controls starting/stopping of plugins
  • conveys exit status back to Harness after each plugin function exits
  • conveys more information (AppInfo, ConfigSection, ...) to plugin functions. Note that not all fields are set for all functions - setting ConfigSection ptr when calling init() makes no sense, for example
Note
Below we only briefly document the methods. For more information, see Harness API documentation for their corresponding free-function proxies in plugin.h

Constructor & Destructor Documentation

◆ PluginFuncEnv()

mysql_harness::PluginFuncEnv::PluginFuncEnv ( const AppInfo *  info,
const ConfigSection section,
bool  running = false 
)

Constructor.

Parameters
infoAppInfo to pass to plugin function. Can be NULL. Pointer is owned by the caller and must outlive plugin function call.
sectionConfigSection to pass to plugin function. Can be NULL. Pointer is owned by the caller and must outlive plugin function call.
runningSet "running" flag. true = plugin should be running

Member Function Documentation

◆ clear_running()

void mysql_harness::PluginFuncEnv::clear_running ( )
noexcept

◆ exit_ok()

bool mysql_harness::PluginFuncEnv::exit_ok ( ) const
noexcept

◆ get_app_info()

const AppInfo * mysql_harness::PluginFuncEnv::get_app_info ( ) const
noexcept

◆ get_config_section()

const ConfigSection * mysql_harness::PluginFuncEnv::get_config_section ( ) const
noexcept

◆ is_running()

bool mysql_harness::PluginFuncEnv::is_running ( ) const
noexcept

◆ pop_error()

std::tuple< std::string, std::exception_ptr > mysql_harness::PluginFuncEnv::pop_error ( )
noexcept

◆ set_error()

void mysql_harness::PluginFuncEnv::set_error ( ErrorType  error_type,
const char *  fmt,
va_list  ap 
)
noexcept

◆ set_running()

void mysql_harness::PluginFuncEnv::set_running ( )
noexcept

◆ wait_for_stop()

bool mysql_harness::PluginFuncEnv::wait_for_stop ( uint32_t  milliseconds) const
noexcept

Member Data Documentation

◆ app_info_

const AppInfo* mysql_harness::PluginFuncEnv::app_info_
private

◆ cond_

std::condition_variable mysql_harness::PluginFuncEnv::cond_
mutableprivate

◆ config_section_

const ConfigSection* mysql_harness::PluginFuncEnv::config_section_
private

◆ error_message_

std::string mysql_harness::PluginFuncEnv::error_message_
private

◆ error_type_

ErrorType mysql_harness::PluginFuncEnv::error_type_ = kNoError
private

◆ mutex_

std::mutex mysql_harness::PluginFuncEnv::mutex_
mutableprivate

◆ running_

bool mysql_harness::PluginFuncEnv::running_
private

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