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 if (vm.count("max-commit-id"))
00049 slave->setMaxCommitId(vm["max-commit-id"].as<uint64_t>());
00050 context.add(slave);
00051 return 0;
00052 }
00053
00054 static void init_options(drizzled::module::option_context &context)
00055 {
00056 context("config-file",
00057 po::value<string>()->default_value(DEFAULT_SLAVE_CFG_FILE.string()),
00058 N_("Path to the slave configuration file"));
00059 context("max-commit-id",
00060 po::value<uint64_t>(),
00061 N_("Value to use as the maximum commit ID stored on the slave"));
00062 }
00063
00064 }
00065
00066 DRIZZLE_DECLARE_PLUGIN
00067 {
00068 DRIZZLE_VERSION_ID,
00069 "slave",
00070 "1.0",
00071 "David Shrewsbury",
00072 "Implements Drizzle replication slave.",
00073 PLUGIN_LICENSE_GPL,
00074 slave::init,
00075 NULL,
00076 slave::init_options
00077 }
00078 DRIZZLE_DECLARE_PLUGIN_END;