drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
default_replicator.cc
Go to the documentation of this file.
1/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *
4 * Copyright (C) 2008-2009 Sun Microsystems, Inc.
5 *
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.
10 *
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.
15 *
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
19 */
20
34
35#include <config.h>
36#include <drizzled/plugin.h>
37#include <drizzled/gettext.h>
38#include <drizzled/plugin/transaction_applier.h>
39
40#include "default_replicator.h"
41
42#include <vector>
43#include <string>
44
45using namespace std;
46using namespace drizzled;
47
48plugin::ReplicationReturnCode
50 Session &in_session,
51 message::Transaction &to_replicate)
52{
53 /*
54 * We do absolutely nothing but call the applier's apply() method, passing
55 * along the supplied Transaction. Yep, told you it was simple...
56 */
57 return in_applier->apply(in_session, to_replicate);
58}
59
60static DefaultReplicator *default_replicator= NULL; /* The singleton replicator */
61
62static int init(module::Context &context)
63{
64 default_replicator= new DefaultReplicator("default_replicator");
65 context.add(default_replicator);
66 return 0;
67}
68
69DRIZZLE_DECLARE_PLUGIN
70{
71 DRIZZLE_VERSION_ID,
72 "default_replicator",
73 "1.0",
74 "Jay Pipes",
75 N_("Replicates all write events to all appliers"),
76 PLUGIN_LICENSE_GPL,
77 init,
78 NULL,
79 NULL,
80}
81DRIZZLE_DECLARE_PLUGIN_END;
drizzled::plugin::ReplicationReturnCode replicate(drizzled::plugin::TransactionApplier *in_applier, drizzled::Session &in_session, drizzled::message::Transaction &to_replicate)
virtual ReplicationReturnCode apply(Session &in_session, const message::Transaction &to_apply)=0
TODO: Rename this file - func.h is stupid.
STL namespace.