~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/memcached_stats/memcached_stats.cc

  • Committer: Brian Aker
  • Date: 2010-10-08 16:11:47 UTC
  • mto: This revision was merged to the branch mainline in revision 1834.
  • Revision ID: brian@tangent.org-20101008161147-o3us2a8itszsaycx
Typdef our lock type.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
#include "config.h"
31
31
#include "drizzled/show.h"
32
32
#include "drizzled/gettext.h"
33
 
 
 
33
#include <boost/program_options.hpp>
 
34
#include <drizzled/module/option_map.h>
34
35
#include "stats_table.h"
35
36
#include "analysis_table.h"
36
37
#include "sysvar_holder.h"
38
39
#include <string>
39
40
#include <map>
40
41
 
 
42
namespace po=boost::program_options;
41
43
using namespace std;
42
44
using namespace drizzled;
43
45
 
59
61
 * @param[in] registry the drizzled::plugin::Registry singleton
60
62
 * @return false on success; true on failure.
61
63
 */
62
 
static int init(plugin::Context &context)
 
64
static int init(module::Context &context)
63
65
{
 
66
  const module::option_map &vm= context.getOptions();
 
67
 
 
68
  if(vm.count("servers"))
 
69
  {
 
70
    sysvar_memcached_servers= strdup(vm["servers"].as<string>().c_str());
 
71
  }
 
72
 
 
73
  else
 
74
  {
 
75
    sysvar_memcached_servers= strdup("");
 
76
  }
64
77
 
65
78
  SysvarHolder &sysvar_holder= SysvarHolder::singleton();
66
79
  sysvar_holder.setServersString(sysvar_memcached_servers);
 
80
  sysvar_holder.setMemoryPtr(sysvar_memcached_servers);
67
81
 
68
82
  /* we are good to go */
69
83
  stats_table_tool= new(std::nothrow)StatsTableTool; 
116
130
                          set_memc_servers, /* update func */
117
131
                          ""); /* default value */
118
132
 
 
133
static void init_options(drizzled::module::option_context &context)
 
134
{
 
135
  context("servers",
 
136
          po::value<string>(),
 
137
          N_("List of memcached servers."));
 
138
}
 
139
 
119
140
static drizzle_sys_var *system_variables[]=
120
141
{
121
142
  DRIZZLE_SYSVAR(servers),
132
153
  PLUGIN_LICENSE_BSD,
133
154
  init,   /* Plugin Init      */
134
155
  system_variables, /* system variables */
135
 
  NULL    /* config options   */
 
156
  init_options    /* config options   */
136
157
}
137
158
DRIZZLE_DECLARE_PLUGIN_END;