42
43
using namespace drizzled;
45
* DATA_DICTIONARY tables.
47
static AnalysisTableTool *analysis_table_tool;
49
static StatsTableTool *stats_table_tool;
46
* Vectors of columns for I_S tables.
48
static vector<const plugin::ColumnInfo *> memcached_stats_columns;
49
static vector<const plugin::ColumnInfo *> memcached_analysis_columns;
52
* Methods for I_S tables.
54
static plugin::InfoSchemaMethods *memcached_stats_methods= NULL;
55
static plugin::InfoSchemaMethods *memcached_analysis_methods= NULL;
60
static plugin::InfoSchemaTable *memcached_stats_table= NULL;
61
static plugin::InfoSchemaTable *memcached_analysis_table= NULL;
52
64
* System variable related variables.
54
66
static char *sysvar_memcached_servers= NULL;
69
* Populate the vectors of columns for each I_S table.
71
* @return false on success; true on failure.
73
static bool initColumns()
75
if (createMemcachedStatsColumns(memcached_stats_columns))
80
if (createMemcachedAnalysisColumns(memcached_analysis_columns))
89
* Clear the vectors of columns for each I_S table.
91
static void cleanupColumns()
93
clearMemcachedColumns(memcached_stats_columns);
94
clearMemcachedColumns(memcached_analysis_columns);
98
* Initialize the methods for each I_S table.
100
* @return false on success; true on failure
102
static bool initMethods()
104
memcached_stats_methods= new(std::nothrow)
105
MemcachedStatsISMethods();
106
if (! memcached_stats_methods)
111
memcached_analysis_methods= new(std::nothrow)
112
MemcachedAnalysisISMethods();
113
if (! memcached_analysis_methods)
122
* Delete memory allocated for the I_S table methods.
124
static void cleanupMethods()
126
delete memcached_stats_methods;
127
delete memcached_analysis_methods;
131
* Initialize the I_S tables related to memcached.
133
* @return false on success; true on failure
135
static bool initMemcachedTables()
137
memcached_stats_table= new(std::nothrow) plugin::InfoSchemaTable("MEMCACHED_STATS",
138
memcached_stats_columns,
139
-1, -1, false, false, 0,
140
memcached_stats_methods);
141
if (! memcached_stats_table)
146
memcached_analysis_table=
147
new(std::nothrow) plugin::InfoSchemaTable("MEMCACHED_ANALYSIS",
148
memcached_analysis_columns,
149
-1, -1, false, false, 0,
150
memcached_analysis_methods);
151
if (! memcached_analysis_table)
160
* Delete memory allocated for the I_S tables.
162
static void cleanupMemcachedTables()
164
delete memcached_stats_table;
165
delete memcached_analysis_table;
57
169
* Initialize the memcached stats plugin.
59
171
* @param[in] registry the drizzled::plugin::Registry singleton
60
172
* @return false on success; true on failure.
62
static int init(plugin::Context &context)
174
static int init(plugin::Registry ®istry)
186
if (initMemcachedTables())
65
191
SysvarHolder &sysvar_holder= SysvarHolder::singleton();
66
192
sysvar_holder.setServersString(sysvar_memcached_servers);
68
194
/* we are good to go */
69
stats_table_tool= new(std::nothrow)StatsTableTool;
70
context.add(stats_table_tool);
72
analysis_table_tool= new(std::nothrow)AnalysisTableTool;
73
context.add(analysis_table_tool);
195
registry.add(memcached_stats_table);
196
registry.add(memcached_analysis_table);
202
* Clean up the memcached stats plugin.
204
* @param[in] registry the drizzled::plugin::Registry singleton
205
* @return false on success; true on failure
207
static int deinit(plugin::Registry ®istry)
209
registry.remove(memcached_stats_table);
210
registry.remove(memcached_analysis_table);
214
cleanupMemcachedTables();