Format filter modules

Formatted filter modules with Astyle.
This commit is contained in:
Markus Mäkelä
2017-01-17 13:45:32 +02:00
parent 4869fd98eb
commit c25b7629f4
33 changed files with 670 additions and 528 deletions

View File

@ -42,7 +42,10 @@ public:
void show(DCB* pDcb) const;
const CACHE_CONFIG& config() const { return m_config; }
const CACHE_CONFIG& config() const
{
return m_config;
}
virtual json_t* get_info(uint32_t what = INFO_ALL) const = 0;

View File

@ -24,8 +24,16 @@ public:
static CacheFilter* create(const char* zName, char** pzOptions, CONFIG_PARAMETER* ppParams);
Cache& cache() { ss_dassert(m_sCache.get()); return *m_sCache.get(); }
const Cache& cache() const { ss_dassert(m_sCache.get()); return *m_sCache.get(); }
Cache& cache()
{
ss_dassert(m_sCache.get());
return *m_sCache.get();
}
const Cache& cache() const
{
ss_dassert(m_sCache.get());
return *m_sCache.get();
}
CacheFilterSession* newSession(SESSION* pSession);

View File

@ -122,10 +122,22 @@ private:
remove();
}
const CACHE_KEY* key() const { return pkey_; }
size_t size() const { return size_; }
Node* next() const { return pnext_; }
Node* prev() const { return pprev_; }
const CACHE_KEY* key() const
{
return pkey_;
}
size_t size() const
{
return size_;
}
Node* next() const
{
return pnext_;
}
Node* prev() const
{
return pprev_;
}
/**
* Move the node before the node provided as argument.

View File

@ -25,7 +25,8 @@
bool RocksDBInternals::is_stale(const rocksdb::Slice& value, int32_t ttl, rocksdb::Env* pEnv)
{
if (ttl <= 0)
{ // Data is fresh if TTL is non-positive
{
// Data is fresh if TTL is non-positive
return false;
}

View File

@ -122,7 +122,8 @@ bool deletePath(const string& path)
// FTS_XDEV - Don't cross filesystem boundaries
FTS *pFts = fts_open(files, FTS_NOCHDIR | FTS_PHYSICAL | FTS_XDEV, NULL);
if (pFts) {
if (pFts)
{
FTSENT* pCurrent;
while ((pCurrent = fts_read(pFts)))
{
@ -178,7 +179,8 @@ bool deletePath(const string& path)
MXS_NOTICE("Deleted cache storage at '%s'.", path.c_str());
}
if (pFts) {
if (pFts)
{
fts_close(pFts);
}
}
@ -393,7 +395,10 @@ cache_result_t RocksDBStorage::Get_key(const char* zDefault_db, const GWBUF& que
// dbs now contain each accessed database in sorted order. Now copy them to a single string.
string tag;
for_each(dbs.begin(), dbs.end(), [&tag](const string& db) { tag.append(db); });
for_each(dbs.begin(), dbs.end(), [&tag](const string & db)
{
tag.append(db);
});
memset(pKey->data, 0, CACHE_KEY_MAXLEN);
@ -432,7 +437,8 @@ cache_result_t RocksDBStorage::get_info(uint32_t what, json_t** ppInfo) const
auto sStatistics = m_sDb->GetOptions().statistics;
for_each(rocksdb::TickersNameMap.begin(), rocksdb::TickersNameMap.end(),
[pInfo, sStatistics](const std::pair<rocksdb::Tickers, string>& tickerName) {
[pInfo, sStatistics](const std::pair<rocksdb::Tickers, string>& tickerName)
{
json_t* pValue = json_integer(sStatistics->getTickerCount(tickerName.first));
if (pValue)

View File

@ -31,7 +31,10 @@ public:
*
* @return Bitmask of @c cache_storage_capabilities_t values.
*/
uint32_t capabilities() const { return m_caps; }
uint32_t capabilities() const
{
return m_caps;
}
/**
* The capabilities of storages loaded via this factory. These
@ -39,7 +42,10 @@ public:
*
* @return Bitmask of @c cache_storage_capabilities_t values.
*/
uint32_t storage_capabilities() const { return m_storage_caps; }
uint32_t storage_capabilities() const
{
return m_storage_caps;
}
/**
* Create storage instance.

View File

@ -46,7 +46,10 @@ public:
return Thread(pTask);
}
Tester::Task* task() { return m_pTask; }
Tester::Task* task()
{
return m_pTask;
}
void start()
{

View File

@ -52,12 +52,18 @@ public:
*
* @return True, if the task should terminate, i.e., return from @c run.
*/
bool should_terminate() const { return m_terminate; }
bool should_terminate() const
{
return m_terminate;
}
/**
* Tell the task to terminate.
*/
void terminate() { m_terminate = true; }
void terminate()
{
m_terminate = true;
}
/**
* Calls terminate on the provided task. For use in algorithms.
@ -98,14 +104,20 @@ public:
*
* @return The value returned by @run.
*/
int rv() const { return m_rv; }
int rv() const
{
return m_rv;
}
/**
* The stream to be used for user output.
*
* @return The output stream to be used.
*/
std::ostream& out() const { return m_out; }
std::ostream& out() const
{
return m_out;
}
protected:
/**
@ -118,7 +130,10 @@ public:
private:
friend class Thread;
void set_rv(int rv) { m_rv = rv; }
void set_rv(int rv)
{
m_rv = rv;
}
private:
Task(const Task&);
@ -249,7 +264,10 @@ protected:
*
* @return A stream.
*/
std::ostream& out() const { return m_out; }
std::ostream& out() const
{
return m_out;
}
/**
* Execute a specific number of tasks in as many threads.

View File

@ -49,7 +49,10 @@ protected:
virtual void print_usage(const char* zProgram);
std::ostream& out() const { return m_out; }
std::ostream& out() const
{
return m_out;
}
private:
TestStorage(const TestStorage&);

View File

@ -85,9 +85,11 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE()
NULL, /* Thread finish. */
{
{ Config::rules_file_name, MXS_MODULE_PARAM_STRING, NULL, MXS_MODULE_OPT_REQUIRED },
{ Config::warn_type_mismatch_name,
{
Config::warn_type_mismatch_name,
MXS_MODULE_PARAM_ENUM, Config::warn_type_mismatch_default,
MXS_MODULE_OPT_NONE, Config::warn_type_mismatch_values },
MXS_MODULE_OPT_NONE, Config::warn_type_mismatch_values
},
{ MXS_END_MODULE_PARAMS }
}
};

View File

@ -39,7 +39,10 @@ public:
void reload(DCB* pOut);
const Config& config() const { return m_config; }
const Config& config() const
{
return m_config;
}
SMaskingRules rules() const;
private:

View File

@ -38,12 +38,27 @@ public:
{}
~MaskingFilterConfig() {}
const std::string& name() const { return m_name; }
const std::string& rules_file() const { return m_rules_file; }
warn_type_mismatch_t warn_type_mismatch() const { return m_warn_type_mismatch; }
const std::string& name() const
{
return m_name;
}
const std::string& rules_file() const
{
return m_rules_file;
}
warn_type_mismatch_t warn_type_mismatch() const
{
return m_warn_type_mismatch;
}
void set_rules_file(const std::string& s) { m_rules_file = s; }
void set_warn_type_mismatch(warn_type_mismatch_t w) { m_warn_type_mismatch = w; }
void set_rules_file(const std::string& s)
{
m_rules_file = s;
}
void set_warn_type_mismatch(warn_type_mismatch_t w)
{
m_warn_type_mismatch = w;
}
static warn_type_mismatch_t get_warn_type_mismatch(const CONFIG_PARAMETER* pParams);

View File

@ -97,11 +97,20 @@ private:
return m_sRules;
}
bool is_multi_result() const { return m_multi_result; }
bool is_multi_result() const
{
return m_multi_result;
}
uint32_t total_fields() const { return m_nTotal_fields; }
uint32_t total_fields() const
{
return m_nTotal_fields;
}
void set_total_fields(uint32_t n) { m_nTotal_fields = n; }
void set_total_fields(uint32_t n)
{
m_nTotal_fields = n;
}
bool append_type_and_rule(enum_field_types type, const MaskingRules::Rule* pRule)
{

View File

@ -90,13 +90,34 @@ public:
std::string match() const;
const std::string& column() const { return m_column; }
const std::string& table() const { return m_table; }
const std::string& database() const { return m_database; }
const std::string& value() const { return m_value; }
const std::string& fill() const { return m_fill; }
const std::vector<SAccount>& applies_to() const { return m_applies_to; }
const std::vector<SAccount>& exempted() const { return m_exempted; }
const std::string& column() const
{
return m_column;
}
const std::string& table() const
{
return m_table;
}
const std::string& database() const
{
return m_database;
}
const std::string& value() const
{
return m_value;
}
const std::string& fill() const
{
return m_fill;
}
const std::vector<SAccount>& applies_to() const
{
return m_applies_to;
}
const std::vector<SAccount>& exempted() const
{
return m_exempted;
}
/**
* Create a Rule instance

View File

@ -488,8 +488,14 @@ public:
ERR_PACKET = 0xff,
};
uint32_t packet_len() const { return m_packet_len; }
uint8_t packet_no() const { return m_packet_no; }
uint32_t packet_len() const
{
return m_packet_len;
}
uint8_t packet_no() const
{
return m_packet_no;
}
protected:
ComPacket(GWBUF* pPacket)
@ -624,7 +630,10 @@ public:
++m_pData;
}
uint8_t command() const { return m_command; }
uint8_t command() const
{
return m_command;
}
protected:
uint8_t m_command;
@ -667,13 +676,34 @@ public:
m_pData += 1;
}
const LEncString& catalog() const { return m_catalog; }
const LEncString& schema() const { return m_schema; }
const LEncString& table() const { return m_table; }
const LEncString& org_table() const { return m_org_table; }
const LEncString& name() const { return m_name; }
const LEncString& org_name() const { return m_org_name; }
enum_field_types type() const { return m_type; }
const LEncString& catalog() const
{
return m_catalog;
}
const LEncString& schema() const
{
return m_schema;
}
const LEncString& table() const
{
return m_table;
}
const LEncString& org_table() const
{
return m_org_table;
}
const LEncString& name() const
{
return m_name;
}
const LEncString& org_name() const
{
return m_org_name;
}
enum_field_types type() const
{
return m_type;
}
std::string to_string() const
{
@ -1162,7 +1192,10 @@ public:
{
}
uint64_t nFields() const { return m_nFields; }
uint64_t nFields() const
{
return m_nFields;
}
private:
LEncInt m_nFields;

View File

@ -173,7 +173,6 @@ static void
freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session)
{
MXS_FREE(session);
return;
}
/**