2
* Copyright (C) 2009, Padraig O'Sullivan
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions are met:
8
* * Redistributions of source code must retain the above copyright notice,
9
* this list of conditions and the following disclaimer.
10
* * Redistributions in binary form must reproduce the above copyright notice,
11
* this list of conditions and the following disclaimer in the documentation
12
* and/or other materials provided with the distribution.
13
* * Neither the name of Padraig O'Sullivan nor the names of its contributors
14
* may be used to endorse or promote products derived from this software
15
* without specific prior written permission.
17
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27
* THE POSSIBILITY OF SUCH DAMAGE.
31
#include "drizzled/show.h"
32
#include "drizzled/gettext.h"
33
#include <boost/program_options.hpp>
34
#include <drizzled/module/option_map.h>
35
#include "stats_table.h"
36
#include "analysis_table.h"
37
#include "sysvar_holder.h"
42
namespace po=boost::program_options;
44
namespace drizzle_plugin
49
* DATA_DICTIONARY tables.
51
static AnalysisTableTool *analysis_table_tool;
53
static StatsTableTool *stats_table_tool;
56
* System variable related variables.
58
static std::string sysvar_memcached_servers;
61
* Initialize the memcached stats plugin.
63
* @param[in] registry the drizzled::plugin::Registry singleton
64
* @return false on success; true on failure.
66
static int init(drizzled::module::Context &context)
68
const drizzled::module::option_map &vm= context.getOptions();
70
/* we are good to go */
71
stats_table_tool= new StatsTableTool;
72
context.add(stats_table_tool);
74
analysis_table_tool= new AnalysisTableTool;
75
context.add(analysis_table_tool);
77
context.registerVariable(new sys_var_std_string("servers",
78
sysvar_memcached_servers));
83
static void init_options(drizzled::module::option_context &context)
86
po::value<std::string>()->default_value(""),
87
_("List of memcached servers."));
90
} /* namespace drizzle_plugin */
92
DRIZZLE_DECLARE_PLUGIN
98
N_("Memcached Stats as I_S tables"),
100
drizzle_plugin::init, /* Plugin Init */
102
drizzle_plugin::init_options /* config options */
104
DRIZZLE_DECLARE_PLUGIN_END;