00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <config.h>
00022 #include <plugin/slave/replication_slave.h>
00023 #include <drizzled/plugin.h>
00024 #include <drizzled/configmake.h>
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 }
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,
00071 slave::init_options
00072 }
00073 DRIZZLE_DECLARE_PLUGIN_END;