MySQL 8.4.3
Source Code Documentation
|
#include <rpl_info_handler.h>
Public Types | |
enum class | enum_field_get_status : int { FIELD_VALUE_NOT_NULL = 0 , FIELD_VALUE_IS_NULL = 1 , FAILURE = 2 } |
Public Member Functions | |
Rpl_info_handler (const Rpl_info_handler &handler)=delete | |
Rpl_info_handler & | operator= (const Rpl_info_handler &handler)=delete |
int | init_info () |
After creating an object and assembling components, this method is used to initialize internal structures. More... | |
enum_return_check | check_info () |
Checks the repository's status. More... | |
int | flush_info (const bool force) |
Flushes and syncs in-memory information into a stable storage (i.e. More... | |
int | remove_info () |
Deletes any information in it and in some cases the repository. More... | |
int | clean_info () |
Deletes any information in the repository. More... | |
void | end_info () |
Closes access to the repository. More... | |
int | prepare_info_for_read () |
Enables the storage system to receive reads, i.e. More... | |
int | prepare_info_for_write () |
Enables the storage system to receive writes, i.e. More... | |
uint | get_rpl_info_type () |
Gets the type of the repository that is used. More... | |
const char * | get_rpl_info_type_str () |
Returns a string corresponding to the type. More... | |
template<class TypeHandler > | |
bool | set_info (TypeHandler const value) |
Sets the value of a field to value . More... | |
template<class TypeHandler > | |
bool | set_info (TypeHandler const value, const size_t size) |
template<class TypeHandler > | |
bool | set_info (int pk_cursor, TypeHandler const value) |
set the value of a field pointed at pk_cursor to @ value. More... | |
template<class TypeHandlerPointer , class TypeHandler > | |
enum_field_get_status | get_info (TypeHandlerPointer value, TypeHandler const default_value) |
Returns the value of a field. More... | |
template<class TypeHandler > | |
enum_field_get_status | get_info (TypeHandler value, const size_t size, std::add_const_t< std::remove_pointer_t< TypeHandler > > *default_value) |
Returns the value of a string field. More... | |
enum_field_get_status | get_info (Server_ids *value, const Server_ids *default_value) |
Returns the value of a Server_id field. More... | |
int | get_number_info () |
Returns the number of fields handled by this handler. More... | |
void | set_sync_period (uint period) |
Configures the number of events after which the info (e.g. More... | |
char * | get_description_info () |
Returns a string describing the repository. More... | |
bool | is_transactional () |
Any transactional repository may have its updates rolled back in case of a failure. More... | |
bool | update_is_transactional () |
Updates the value returned by the member function is_transactional() because it may be expensive to compute it whenever is_transactional() is called. More... | |
virtual | ~Rpl_info_handler () |
Public Attributes | |
Rpl_info_values * | field_values |
Protected Member Functions | |
Rpl_info_handler (const int nparam, MY_BITMAP const *nullable_bitmap) | |
bool | is_field_nullable (int pos) |
Checks whether or not the field at position pos is allowed to be NULL . More... | |
Protected Attributes | |
int | ninfo |
int | cursor |
bool | prv_error |
enum_field_get_status | prv_get_error |
uint | sync_counter |
uint | sync_period |
MY_BITMAP | nullable_fields |
Bitset holding which of the fields are allowed to be NULL . More... | |
Private Member Functions | |
virtual int | do_init_info ()=0 |
virtual int | do_init_info (uint instance)=0 |
virtual enum_return_check | do_check_info ()=0 |
virtual enum_return_check | do_check_info (uint instance)=0 |
virtual int | do_flush_info (const bool force)=0 |
virtual int | do_remove_info ()=0 |
virtual int | do_clean_info ()=0 |
virtual void | do_end_info ()=0 |
virtual int | do_prepare_info_for_read ()=0 |
virtual int | do_prepare_info_for_write ()=0 |
virtual bool | do_set_info (const int pos, const char *value)=0 |
virtual bool | do_set_info (const int pos, const uchar *value, const size_t size)=0 |
virtual bool | do_set_info (const int pos, const ulong value)=0 |
virtual bool | do_set_info (const int pos, const int value)=0 |
virtual bool | do_set_info (const int pos, const float value)=0 |
virtual bool | do_set_info (const int pos, const Server_ids *value)=0 |
virtual bool | do_set_info (const int pos, const std::nullptr_t value)=0 |
virtual bool | do_set_info (const int pos, const std::nullptr_t value, const size_t size)=0 |
virtual enum_field_get_status | do_get_info (const int pos, char *value, const size_t size, const char *default_value)=0 |
virtual enum_field_get_status | do_get_info (const int pos, uchar *value, const size_t size, const uchar *default_value)=0 |
virtual enum_field_get_status | do_get_info (const int pos, ulong *value, const ulong default_value)=0 |
virtual enum_field_get_status | do_get_info (const int pos, int *value, const int default_value)=0 |
virtual enum_field_get_status | do_get_info (const int pos, float *value, const float default_value)=0 |
virtual enum_field_get_status | do_get_info (const int pos, Server_ids *value, const Server_ids *default_value)=0 |
virtual char * | do_get_description_info ()=0 |
virtual bool | do_is_transactional ()=0 |
virtual bool | do_update_is_transactional ()=0 |
virtual uint | do_get_rpl_info_type ()=0 |
Friends | |
class | Rpl_info_factory |
|
strong |
|
delete |
|
virtual |
|
protected |
|
inline |
Checks the repository's status.
REPOSITORY_EXISTS | reposistory is ready to be used. |
REPOSITORY_DOES_NOT_EXIST | repository needs to be configured. |
ERROR_CHECKING_REPOSITORY | error while checking the reposistory. |
|
inline |
Deletes any information in the repository.
In contrast to the remove_info()
method, the repository is not removed.
false | No error |
true | Failure |
|
privatepure virtual |
Implemented in Rpl_info_dummy, and Rpl_info_table.
|
privatepure virtual |
Implemented in Rpl_info_dummy, and Rpl_info_table.
|
privatepure virtual |
Implemented in Rpl_info_dummy, and Rpl_info_table.
|
privatepure virtual |
Implemented in Rpl_info_dummy, and Rpl_info_table.
|
privatepure virtual |
Implemented in Rpl_info_dummy, and Rpl_info_table.
|
privatepure virtual |
Implemented in Rpl_info_dummy, and Rpl_info_table.
|
privatepure virtual |
Implemented in Rpl_info_dummy, and Rpl_info_table.
|
privatepure virtual |
Implemented in Rpl_info_dummy, and Rpl_info_table.
|
privatepure virtual |
Implemented in Rpl_info_dummy, and Rpl_info_table.
|
privatepure virtual |
Implemented in Rpl_info_dummy, and Rpl_info_table.
|
privatepure virtual |
Implemented in Rpl_info_dummy, and Rpl_info_table.
|
privatepure virtual |
Implemented in Rpl_info_dummy, and Rpl_info_table.
|
privatepure virtual |
Implemented in Rpl_info_dummy, and Rpl_info_table.
|
privatepure virtual |
Implemented in Rpl_info_dummy, and Rpl_info_table.
|
privatepure virtual |
Implemented in Rpl_info_dummy, and Rpl_info_table.
|
privatepure virtual |
Implemented in Rpl_info_dummy, and Rpl_info_table.
|
privatepure virtual |
Implemented in Rpl_info_dummy, and Rpl_info_table.
|
privatepure virtual |
Implemented in Rpl_info_dummy, and Rpl_info_table.
|
privatepure virtual |
Implemented in Rpl_info_dummy, and Rpl_info_table.
|
privatepure virtual |
Implemented in Rpl_info_dummy, and Rpl_info_table.
|
privatepure virtual |
Implemented in Rpl_info_dummy, and Rpl_info_table.
|
privatepure virtual |
Implemented in Rpl_info_dummy, and Rpl_info_table.
|
privatepure virtual |
Implemented in Rpl_info_dummy, and Rpl_info_table.
|
privatepure virtual |
Implemented in Rpl_info_dummy, and Rpl_info_table.
|
privatepure virtual |
Implemented in Rpl_info_dummy, and Rpl_info_table.
|
privatepure virtual |
Implemented in Rpl_info_dummy, and Rpl_info_table.
|
privatepure virtual |
Implemented in Rpl_info_dummy, and Rpl_info_table.
|
privatepure virtual |
Implemented in Rpl_info_dummy, and Rpl_info_table.
|
inline |
Closes access to the repository.
|
inline |
Flushes and syncs in-memory information into a stable storage (i.e.
repository). Usually, syncing after flushing depends on other options such as relay-log-info-sync
, master-info-sync
. These options dictate after how many events or transactions the information should be synced. We can ignore them and always sync by setting the parameter force
, which is by default false
, to true
.
So if the number of events is below a threshold, the parameter force
is false and we are using a file system as a storage system, it may happen that the changes will only end up in the operating system's cache and a crash may lead to inconsistencies.
false | No error |
true | Failure |
|
inline |
Returns a string describing the repository.
For instance, if the repository is a file, the returned string is path where data is stored.
|
inline |
Returns the value of a Server_id field.
Any call must be done in the right order which is defined by the caller that wants to return the information.
[out] | value | Value to be return. |
[in] | default_value | Returns a default value if the field is empty. |
false | No error |
true | Failure |
|
inline |
Returns the value of a string field.
Any call must be done in the right order which is defined by the caller that wants to return the information.
[in] | value | Value to be returned. |
[in] | size | Max size of the string to be returned. |
[in] | default_value | Returns a default value if the field is empty. |
TypeHandler is either char* or uchar*, while default_value is const char* or const uchar*. Some type trait magic is required to make char* / uchar* into const char* / uchar*.
false | No error |
true | Failure |
|
inline |
Returns the value of a field.
Any call must be done in the right order which is defined by the caller that wants to return the information.
[in] | value | Value to be set. |
[in] | default_value | Returns a default value if the field is empty. |
false | No error |
true | Failure |
|
inline |
Returns the number of fields handled by this handler.
|
inline |
Gets the type of the repository that is used.
const char * Rpl_info_handler::get_rpl_info_type_str | ( | ) |
Returns a string corresponding to the type.
|
inline |
After creating an object and assembling components, this method is used to initialize internal structures.
Everything that does not depend on other components (e.g. mutexes) should be placed in the object's constructor though.
false | success, |
true | otherwise error. |
|
protected |
Checks whether or not the field at position pos
is allowed to be NULL
.
NULL
and false otherwise.
|
inline |
Any transactional repository may have its updates rolled back in case of a failure.
If this is possible, the repository is classified as transactional.
true | If transactional. |
false | Otherwise. |
|
delete |
|
inline |
Enables the storage system to receive reads, i.e.
getters.
false | No error |
true | Failure |
|
inline |
Enables the storage system to receive writes, i.e.
setters.
false | No error |
true | Failure |
|
inline |
Deletes any information in it and in some cases the repository.
The decision to remove the repository is delegated to the developer.
false | No error |
true | Failure |
|
inline |
set the value of a field pointed at pk_cursor
to @ value.
[in] | pk_cursor | cursor for the field value. |
[in] | value | field[pk_cursor] is set to this value. |
false | ok |
true | error. |
|
inline |
Sets the value of a field to value
.
Any call must be done in the right order which is defined by the caller that wants to persist the information.
[in] | value | Value to be set. |
false | No error |
true | Failure |
|
inline |
void Rpl_info_handler::set_sync_period | ( | uint | period | ) |
Configures the number of events after which the info (e.g.
master info, relay log info) must be synced when flush() is called.
[in] | period | Number of events. |
|
inline |
Updates the value returned by the member function is_transactional() because it may be expensive to compute it whenever is_transactional() is called.
In the current implementation, the type of the repository can only be changed when replication, i.e. slave, is stopped. For that reason, this member function, i.e. update_is__transactional(), must be called when slave is starting.
false | No error |
true | Failure |
|
friend |
|
protected |
Rpl_info_values* Rpl_info_handler::field_values |
|
protected |
|
protected |
Bitset holding which of the fields are allowed to be NULL
.
|
protected |
|
protected |
|
protected |
|
protected |