Public Types | |
typedef std::pair< const std::string, const std::string > | map_key |
typedef std::map< const map_key, plugin::Plugin * > | map |
typedef std::vector< Plugin * > | vector |
Public Member Functions | |
FilteredReplicator (std::string name_arg, const std::string &sch_filter, const std::string &tab_filter, const std::string &sch_regex, const std::string &tab_regex) | |
~FilteredReplicator () | |
drizzled::plugin::ReplicationReturnCode | replicate (drizzled::plugin::TransactionApplier *in_applier, drizzled::Session &in_session, drizzled::message::Transaction &to_replicate) |
void | setSchemaFilter (const std::string &input) |
const std::string & | getSchemaFilter () const |
void | setTableFilter (const std::string &input) |
const std::string & | getTableFilter () const |
void | updateTableSysvar (const char **var_ptr) |
void | updateSchemaSysvar (const char **var_ptr) |
virtual void | shutdownPlugin () |
virtual void | prime () |
virtual void | startup (drizzled::Session &) |
void | activate () |
void | deactivate () |
bool | isActive () const |
const std::string & | getName () const |
void | setModule (module::Module *module) |
const std::string & | getTypeName () const |
virtual bool | removeLast () const |
const std::string & | getModuleName () const |
Static Public Member Functions | |
static bool | addPlugin (TransactionReplicator *replicator) |
static void | removePlugin (TransactionReplicator *replicator) |
Private Member Functions | |
void | populateFilter (std::string input, std::vector< std::string > &filter) |
bool | isSchemaFiltered (const std::string &schema_name) |
bool | isTableFiltered (const std::string &table_name) |
void | parseStatementTableMetadata (const drizzled::message::Statement &in_statement, std::string &in_schema_name, std::string &in_table_name) const |
void | parseQuery (const std::string &sql, std::string &schema_name, std::string &table_name) |
Private Attributes | |
std::vector< std::string > | schemas_to_filter |
std::vector< std::string > | tables_to_filter |
std::string | _sch_filter |
std::string | _tab_filter |
const std::string | _sch_regex |
const std::string | _tab_regex |
pthread_mutex_t | sch_vector_lock |
pthread_mutex_t | tab_vector_lock |
pthread_mutex_t | sysvar_sch_lock |
pthread_mutex_t | sysvar_tab_lock |
pcre * | sch_re |
pcre * | tab_re |
Definition at line 43 of file filtered_replicator.h.
drizzle_plugin::FilteredReplicator::~FilteredReplicator | ( | ) |
Destructor
Definition at line 130 of file filtered_replicator.cc.
const std::string& drizzle_plugin::FilteredReplicator::getSchemaFilter | ( | ) | const [inline] |
Definition at line 90 of file filtered_replicator.h.
const std::string& drizzle_plugin::FilteredReplicator::getTableFilter | ( | ) | const [inline] |
Definition at line 107 of file filtered_replicator.h.
bool drizzle_plugin::FilteredReplicator::isSchemaFiltered | ( | const std::string & | schema_name | ) | [private] |
Search the vector of schemas to filter to determine whether the given schema should be filtered or not. The parameter is obtained from the Transaction message passed to the replicator.
[in] | schema_name | name of schema to search for |
Definition at line 321 of file filtered_replicator.cc.
bool drizzle_plugin::FilteredReplicator::isTableFiltered | ( | const std::string & | table_name | ) | [private] |
Search the vector of tables to filter to determine whether the given table should be filtered or not. The parameter is obtained from the Transaction message passed to the replicator.
[in] | table_name | name of table to search for |
Definition at line 358 of file filtered_replicator.cc.
void drizzle_plugin::FilteredReplicator::parseQuery | ( | const std::string & | sql, |
std::string & | schema_name, | ||
std::string & | table_name | ||
) | [private] |
If the command message consists of raw SQL, this method parses a string representation of the raw SQL and extracts the schema name and table name from that raw SQL.
[in] | sql | std::string representation of the raw SQL |
[out] | schema_name | parameter to be populated with the schema name from the parsed SQL |
[out] | table_name | parameter to be populated with the table name from the parsed SQL |
Definition at line 395 of file filtered_replicator.cc.
void drizzle_plugin::FilteredReplicator::parseStatementTableMetadata | ( | const drizzled::message::Statement & | in_statement, |
std::string & | in_schema_name, | ||
std::string & | in_table_name | ||
) | const [private] |
void drizzle_plugin::FilteredReplicator::populateFilter | ( | std::string | input, |
std::vector< std::string > & | filter | ||
) | [private] |
Given a comma-separated string, parse that string to obtain each entry and add each entry to the supplied vector.
[in] | input | a comma-separated string of entries |
[out] | filter | a std::vector to be populated with the entries from the input string |
Definition at line 301 of file filtered_replicator.cc.
plugin::ReplicationReturnCode drizzle_plugin::FilteredReplicator::replicate | ( | drizzled::plugin::TransactionApplier * | in_applier, |
drizzled::Session & | in_session, | ||
drizzled::message::Transaction & | to_replicate | ||
) | [virtual] |
Replicate a Transaction message to an Applier.
It is important to note that memory allocation for the supplied pointer is not guaranteed after the completion of this function -- meaning the caller can dispose of the supplied message. Therefore, replicators and appliers implementing an asynchronous replication system must copy the supplied message to their own controlled memory storage area.
Applier | to replicate to |
Session | descriptor |
Transaction | message to be replicated |
Implements drizzled::plugin::TransactionReplicator.
Definition at line 49 of file default_replicator.cc.
References drizzled::plugin::TransactionApplier::apply().
void drizzle_plugin::FilteredReplicator::setSchemaFilter | ( | const std::string & | input | ) |
Populate the vector of schemas to filter from the comma-separated list of schemas given. This method clears the vector first.
[in] | input | comma-separated filter to use |
Definition at line 494 of file filtered_replicator.cc.
void drizzle_plugin::FilteredReplicator::setTableFilter | ( | const std::string & | input | ) |
Populate the vector of tables to filter from the comma-separated list of tables given. This method clears the vector first.
[in] | input | comma-separated filter to use |
Definition at line 505 of file filtered_replicator.cc.
void drizzle_plugin::FilteredReplicator::updateSchemaSysvar | ( | const char ** | var_ptr | ) | [inline] |
Update the given system variable and release the mutex associated with this system variable.
[out] | var_ptr | the system variable to update |
Definition at line 130 of file filtered_replicator.h.
void drizzle_plugin::FilteredReplicator::updateTableSysvar | ( | const char ** | var_ptr | ) | [inline] |
Update the given system variable and release the mutex associated with this system variable.
[out] | var_ptr | the system variable to update |
Definition at line 118 of file filtered_replicator.h.