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/replicator.h
27
* @see drizzled/plugin/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
* Want a neat project? Take this skeleton replicator and make a
37
* simple filtered replicator which allows the user to filter out
38
* events based on a schema or table name...
41
#include "default_replicator.h"
43
#include <drizzled/gettext.h>
44
#include <drizzled/message/transaction.pb.h>
51
static bool sysvar_default_replicator_enable= false;
53
bool DefaultReplicator::isActive()
55
return sysvar_default_replicator_enable;
58
void DefaultReplicator::replicate(drizzled::plugin::Applier *in_applier, drizzled::message::Command *to_replicate)
61
* We do absolutely nothing but call the applier's apply() method, passing
62
* along the supplied Command. Yep, told you it was simple...
64
in_applier->apply(to_replicate);
67
static DefaultReplicator *default_replicator= NULL; /* The singleton replicator */
69
static int init(PluginRegistry ®istry)
71
default_replicator= new DefaultReplicator();
72
registry.add(default_replicator);
76
static int deinit(PluginRegistry ®istry)
78
if (default_replicator)
80
registry.remove(default_replicator);
81
delete default_replicator;
86
static DRIZZLE_SYSVAR_BOOL(
88
sysvar_default_replicator_enable,
90
N_("Enable default replicator"),
91
NULL, /* check func */
92
NULL, /* update func */
95
static struct st_mysql_sys_var* default_replicator_system_variables[]= {
96
DRIZZLE_SYSVAR(enable),
100
drizzle_declare_plugin(default_replicator)
102
"default_replicator",
105
N_("Default Replicator"),
107
init, /* Plugin Init */
108
deinit, /* Plugin Deinit */
109
NULL, /* status variables */
110
default_replicator_system_variables, /* system variables */
111
NULL /* config options */
113
drizzle_declare_plugin_end;