Drizzled Public API Documentation

drizzle_plugin::FilteredReplicator Class Reference
Inheritance diagram for drizzle_plugin::FilteredReplicator:
drizzled::plugin::TransactionReplicator drizzled::plugin::Plugin

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

Detailed Description

Definition at line 43 of file filtered_replicator.h.

Constructor & Destructor Documentation

drizzle_plugin::FilteredReplicator::~FilteredReplicator ( )

Destructor

Definition at line 130 of file filtered_replicator.cc.

Member Function Documentation

const std::string& drizzle_plugin::FilteredReplicator::getSchemaFilter ( ) const
inline
Returns
string of comma-separated list of schemas to filter

Definition at line 90 of file filtered_replicator.h.

const std::string& drizzle_plugin::FilteredReplicator::getTableFilter ( ) const
inline
Returns
string of comma-separated list of tables to filter

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.

Parameters
[in]schema_namename of schema to search for
Returns
true if the given schema should be filtered; false otherwise

Definition at line 317 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.

Parameters
[in]table_namename of table to search for
Returns
true if the given table should be filtered; false otherwise

Definition at line 343 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.

Parameters
[in]sqlstd::string representation of the raw SQL
[out]schema_nameparameter to be populated with the schema name from the parsed SQL
[out]table_nameparameter to be populated with the table name from the parsed SQL

Definition at line 369 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

Given a supplied Statement message, parse out the table and schema name from the various metadata and header pieces for the different Statement types.

Parameters
[in]Statementto parse
[out]Schemaname to fill
[out]Tablename to fill

Definition at line 148 of file filtered_replicator.cc.

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.

Parameters
[in]inputa comma-separated string of entries
[out]filtera std::vector to be populated with the entries from the input string

Definition at line 298 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.

Note

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.

Parameters
Applierto replicate to
Sessiondescriptor
Transactionmessage to be replicated

Implements drizzled::plugin::TransactionReplicator.

Definition at line 223 of file filtered_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.

Parameters
[in]inputcomma-separated filter to use

Definition at line 467 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.

Parameters
[in]inputcomma-separated filter to use

Definition at line 478 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.

Parameters
[out]var_ptrthe 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.

Parameters
[out]var_ptrthe system variable to update

Definition at line 118 of file filtered_replicator.h.


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