MySQL  8.0.16
Source Code Documentation
Rpl_info_handler Class Referenceabstract

#include <rpl_info_handler.h>

Inheritance diagram for Rpl_info_handler:
Rpl_info_dummy Rpl_info_file Rpl_info_table

Public Member Functions

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 >
bool get_info (TypeHandlerPointer value, TypeHandler const default_value)
 Returns the value of a field. More...
 
template<class TypeHandler >
bool get_info (TypeHandler value, const size_t size, TypeHandler const default_value)
 Returns the value of a string field. More...
 
bool 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_valuesfield_values
 

Protected Member Functions

 Rpl_info_handler (const int nparam)
 

Protected Attributes

int ninfo
 
int cursor
 
bool prv_error
 
uint sync_counter
 
uint sync_period
 

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_get_info (const int pos, char *value, const size_t size, const char *default_value)=0
 
virtual bool do_get_info (const int pos, uchar *value, const size_t size, const uchar *default_value)=0
 
virtual bool do_get_info (const int pos, ulong *value, const ulong default_value)=0
 
virtual bool do_get_info (const int pos, int *value, const int default_value)=0
 
virtual bool do_get_info (const int pos, float *value, const float default_value)=0
 
virtual bool 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
 
 Rpl_info_handler (const Rpl_info_handler &handler)
 
Rpl_info_handleroperator= (const Rpl_info_handler &handler)
 

Friends

class Rpl_info_factory
 

Constructor & Destructor Documentation

◆ ~Rpl_info_handler()

Rpl_info_handler::~Rpl_info_handler ( )
virtual

◆ Rpl_info_handler() [1/2]

Rpl_info_handler::Rpl_info_handler ( const int  nparam)
protected

◆ Rpl_info_handler() [2/2]

Rpl_info_handler::Rpl_info_handler ( const Rpl_info_handler handler)
private

Member Function Documentation

◆ check_info()

enum_return_check Rpl_info_handler::check_info ( )
inline

Checks the repository's status.

Return values
REPOSITORY_EXISTSreposistory is ready to be used.
REPOSITORY_DOES_NOT_EXISTrepository needs to be configured.
ERROR_CHECKING_REPOSITORYerror while checking the reposistory.

◆ clean_info()

int Rpl_info_handler::clean_info ( )
inline

Deletes any information in the repository.

In contrast to the remove_info() method, the repository is not removed.

Return values
falseNo error
trueFailure

◆ do_check_info() [1/2]

virtual enum_return_check Rpl_info_handler::do_check_info ( )
privatepure virtual

◆ do_check_info() [2/2]

virtual enum_return_check Rpl_info_handler::do_check_info ( uint  instance)
privatepure virtual

◆ do_clean_info()

virtual int Rpl_info_handler::do_clean_info ( )
privatepure virtual

◆ do_end_info()

virtual void Rpl_info_handler::do_end_info ( )
privatepure virtual

◆ do_flush_info()

virtual int Rpl_info_handler::do_flush_info ( const bool  force)
privatepure virtual

◆ do_get_description_info()

virtual char* Rpl_info_handler::do_get_description_info ( )
privatepure virtual

◆ do_get_info() [1/6]

virtual bool Rpl_info_handler::do_get_info ( const int  pos,
char *  value,
const size_t  size,
const char *  default_value 
)
privatepure virtual

◆ do_get_info() [2/6]

virtual bool Rpl_info_handler::do_get_info ( const int  pos,
uchar value,
const size_t  size,
const uchar default_value 
)
privatepure virtual

◆ do_get_info() [3/6]

virtual bool Rpl_info_handler::do_get_info ( const int  pos,
ulong value,
const ulong  default_value 
)
privatepure virtual

◆ do_get_info() [4/6]

virtual bool Rpl_info_handler::do_get_info ( const int  pos,
int *  value,
const int  default_value 
)
privatepure virtual

◆ do_get_info() [5/6]

virtual bool Rpl_info_handler::do_get_info ( const int  pos,
float *  value,
const float  default_value 
)
privatepure virtual

◆ do_get_info() [6/6]

virtual bool Rpl_info_handler::do_get_info ( const int  pos,
Server_ids value,
const Server_ids default_value 
)
privatepure virtual

◆ do_get_rpl_info_type()

virtual uint Rpl_info_handler::do_get_rpl_info_type ( )
privatepure virtual

◆ do_init_info() [1/2]

virtual int Rpl_info_handler::do_init_info ( )
privatepure virtual

◆ do_init_info() [2/2]

virtual int Rpl_info_handler::do_init_info ( uint  instance)
privatepure virtual

◆ do_is_transactional()

virtual bool Rpl_info_handler::do_is_transactional ( )
privatepure virtual

◆ do_prepare_info_for_read()

virtual int Rpl_info_handler::do_prepare_info_for_read ( )
privatepure virtual

◆ do_prepare_info_for_write()

virtual int Rpl_info_handler::do_prepare_info_for_write ( )
privatepure virtual

◆ do_remove_info()

virtual int Rpl_info_handler::do_remove_info ( )
privatepure virtual

◆ do_set_info() [1/6]

virtual bool Rpl_info_handler::do_set_info ( const int  pos,
const char *  value 
)
privatepure virtual

◆ do_set_info() [2/6]

virtual bool Rpl_info_handler::do_set_info ( const int  pos,
const uchar value,
const size_t  size 
)
privatepure virtual

◆ do_set_info() [3/6]

virtual bool Rpl_info_handler::do_set_info ( const int  pos,
const ulong  value 
)
privatepure virtual

◆ do_set_info() [4/6]

virtual bool Rpl_info_handler::do_set_info ( const int  pos,
const int  value 
)
privatepure virtual

◆ do_set_info() [5/6]

virtual bool Rpl_info_handler::do_set_info ( const int  pos,
const float  value 
)
privatepure virtual

◆ do_set_info() [6/6]

virtual bool Rpl_info_handler::do_set_info ( const int  pos,
const Server_ids value 
)
privatepure virtual

◆ do_update_is_transactional()

virtual bool Rpl_info_handler::do_update_is_transactional ( )
privatepure virtual

◆ end_info()

void Rpl_info_handler::end_info ( )
inline

Closes access to the repository.

Return values
falseNo error
trueFailure

◆ flush_info()

int Rpl_info_handler::flush_info ( const bool  force)
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.

Return values
falseNo error
trueFailure

◆ get_description_info()

char* Rpl_info_handler::get_description_info ( )
inline

Returns a string describing the repository.

For instance, if the repository is a file, the returned string is path where data is stored.

Returns
a pointer to a string.

◆ get_info() [1/3]

template<class TypeHandlerPointer , class TypeHandler >
bool Rpl_info_handler::get_info ( TypeHandlerPointer  value,
TypeHandler const  default_value 
)
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.

Parameters
[in]valueValue to be set.
[in]default_valueReturns a default value if the field is empty.
Return values
falseNo error
trueFailure

◆ get_info() [2/3]

template<class TypeHandler >
bool Rpl_info_handler::get_info ( TypeHandler  value,
const size_t  size,
TypeHandler const  default_value 
)
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.

Parameters
[in]valueValue to be returned.
[in]sizeMax size of the string to be returned.
[in]default_valueReturns a default value if the field is empty.
Return values
falseNo error
trueFailure

◆ get_info() [3/3]

bool Rpl_info_handler::get_info ( Server_ids value,
const Server_ids default_value 
)
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.

Parameters
[out]valueValue to be return.
[in]default_valueReturns a default value if the field is empty.
Return values
falseNo error
trueFailure

◆ get_number_info()

int Rpl_info_handler::get_number_info ( )
inline

Returns the number of fields handled by this handler.

Returns
Number of fields handled by the handler.

◆ get_rpl_info_type()

uint Rpl_info_handler::get_rpl_info_type ( )
inline

Gets the type of the repository that is used.

Returns
Type of repository.

◆ get_rpl_info_type_str()

const char * Rpl_info_handler::get_rpl_info_type_str ( )

Returns a string corresponding to the type.

◆ init_info()

int Rpl_info_handler::init_info ( )
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.

Return values
falsesuccess,
trueotherwise error.

◆ is_transactional()

bool Rpl_info_handler::is_transactional ( )
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.

Return values
trueIf transactional.
falseOtherwise.

◆ operator=()

Rpl_info_handler& Rpl_info_handler::operator= ( const Rpl_info_handler handler)
private

◆ prepare_info_for_read()

int Rpl_info_handler::prepare_info_for_read ( )
inline

Enables the storage system to receive reads, i.e.

getters.

Return values
falseNo error
trueFailure

◆ prepare_info_for_write()

int Rpl_info_handler::prepare_info_for_write ( )
inline

Enables the storage system to receive writes, i.e.

setters.

Return values
falseNo error
trueFailure

◆ remove_info()

int Rpl_info_handler::remove_info ( )
inline

Deletes any information in it and in some cases the repository.

The decision to remove the repository is delegated to the developer.

Return values
falseNo error
trueFailure

◆ set_info() [1/3]

template<class TypeHandler >
bool Rpl_info_handler::set_info ( TypeHandler const  value)
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.

Parameters
[in]valueValue to be set.
Return values
falseNo error
trueFailure

◆ set_info() [2/3]

template<class TypeHandler >
bool Rpl_info_handler::set_info ( TypeHandler const  value,
const size_t  size 
)
inline

◆ set_info() [3/3]

template<class TypeHandler >
bool Rpl_info_handler::set_info ( int  pk_cursor,
TypeHandler const  value 
)
inline

set the value of a field pointed at pk_cursor to @ value.

Parameters
[in]pk_cursorcursor for the filed value.
[in]valuefieled[pk_cursor] would be set this value.
Return values
falseok
trueerror.

◆ set_sync_period()

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.

Parameters
[in]periodNumber of events.

◆ update_is_transactional()

bool Rpl_info_handler::update_is_transactional ( )
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.

Return values
falseNo error
trueFailure

Friends And Related Function Documentation

◆ Rpl_info_factory

friend class Rpl_info_factory
friend

Member Data Documentation

◆ cursor

int Rpl_info_handler::cursor
protected

◆ field_values

Rpl_info_values* Rpl_info_handler::field_values

◆ ninfo

int Rpl_info_handler::ninfo
protected

◆ prv_error

bool Rpl_info_handler::prv_error
protected

◆ sync_counter

uint Rpl_info_handler::sync_counter
protected

◆ sync_period

uint Rpl_info_handler::sync_period
protected

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