Drizzled Public API Documentation

module.cc
00001 /* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002  *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
00003  *
00004  *  Copyright (C) 2011 David Shrewsbury
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00019  */
00020 
00021 #include <config.h>
00022 #include <plugin/slave/replication_slave.h>
00023 #include <drizzled/plugin.h>
00024 #include <drizzled/configmake.h>   // for SYSCONFDIR
00025 #include <drizzled/module/option_map.h>
00026 #include <boost/program_options.hpp>
00027 #include <boost/filesystem.hpp>
00028 #include <string>
00029 
00030 using namespace drizzled;
00031 using namespace std;
00032 
00033 namespace po= boost::program_options;
00034 namespace fs= boost::filesystem;
00035 
00036 namespace slave
00037 {
00038 
00039 static const fs::path DEFAULT_SLAVE_CFG_FILE= SYSCONFDIR "/slave.cfg";
00040 
00041 static string slave_config;
00042 
00043 static int init(module::Context &context)
00044 {
00045   const module::option_map &vm= context.getOptions();
00046 
00047   ReplicationSlave *slave= new ReplicationSlave(vm["config-file"].as<string>());
00048   context.add(slave);
00049   return 0;
00050 }
00051 
00052 static void init_options(drizzled::module::option_context &context)
00053 {
00054   context("config-file",
00055           po::value<string>()->default_value(DEFAULT_SLAVE_CFG_FILE.string()),
00056           N_("Path to the slave configuration file"));
00057 }
00058 
00059 } /* namespace slave */
00060 
00061 DRIZZLE_DECLARE_PLUGIN
00062 {
00063   DRIZZLE_VERSION_ID,
00064   "slave",
00065   "1.0",
00066   "David Shrewsbury",
00067   "Implements Drizzle replication slave.",
00068   PLUGIN_LICENSE_GPL,
00069   slave::init,
00070   NULL,                  /* depends */
00071   slave::init_options    /* config options */
00072 }
00073 DRIZZLE_DECLARE_PLUGIN_END;