1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008-2009 Sun Microsystems
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
* Defines the implementation of the default replicator.
26
* @see drizzled/plugin/transaction_replicator.h
27
* @see drizzled/plugin/transaction_applier.h
31
* This is a very simple implementation. All we do is pass along the
32
* event to the supplier. This is meant as a skeleton replicator only.
36
#include <drizzled/plugin/registry.h>
37
#include <drizzled/plugin.h>
38
#include <drizzled/gettext.h>
39
#include <drizzled/plugin/transaction_applier.h>
41
#include "default_replicator.h"
47
using namespace drizzled;
49
static bool sysvar_default_replicator_enable= false;
51
bool DefaultReplicator::isEnabled() const
53
return sysvar_default_replicator_enable;
56
void DefaultReplicator::enable()
58
sysvar_default_replicator_enable= true;
61
void DefaultReplicator::disable()
63
sysvar_default_replicator_enable= false;
66
void DefaultReplicator::replicate(plugin::TransactionApplier *in_applier, message::Transaction &to_replicate)
69
* We do absolutely nothing but call the applier's apply() method, passing
70
* along the supplied Transaction. Yep, told you it was simple...
72
in_applier->apply(to_replicate);
75
static DefaultReplicator *default_replicator= NULL; /* The singleton replicator */
77
static int init(plugin::Registry ®istry)
79
default_replicator= new DefaultReplicator("default_replicator");
80
registry.add(default_replicator);
84
static int deinit(plugin::Registry ®istry)
86
if (default_replicator)
88
registry.remove(default_replicator);
89
delete default_replicator;
94
static DRIZZLE_SYSVAR_BOOL(
96
sysvar_default_replicator_enable,
98
N_("Enable default replicator"),
99
NULL, /* check func */
100
NULL, /* update func */
101
false /* default */);
103
static drizzle_sys_var* default_replicator_system_variables[]= {
104
DRIZZLE_SYSVAR(enable),
108
DRIZZLE_DECLARE_PLUGIN
111
"default_replicator",
114
N_("Default Replicator"),
116
init, /* Plugin Init */
117
deinit, /* Plugin Deinit */
118
default_replicator_system_variables, /* system variables */
119
NULL /* config options */
121
DRIZZLE_DECLARE_PLUGIN_END;