~drizzle-trunk/drizzle/development

1039.5.1 by Jay Pipes
* New serial event log plugin
1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
1999.6.1 by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file
4
 *  Copyright (C) 2008-2009 Sun Microsystems, Inc.
1039.5.1 by Jay Pipes
* New serial event log plugin
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
21
/**
22
 * @file
23
 *
24
 * Defines the implementation of the default replicator.
25
 *
1143.2.10 by Jay Pipes
Phase 2 new replication work:
26
 * @see drizzled/plugin/transaction_replicator.h
27
 * @see drizzled/plugin/transaction_applier.h
1039.5.1 by Jay Pipes
* New serial event log plugin
28
 *
29
 * @details
30
 *
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.
33
 */
34
1241.9.36 by Monty Taylor
ZOMG. I deleted drizzled/server_includes.h.
35
#include "config.h"
1237.9.3 by Padraig O'Sullivan
Removed one the includes I put in server_includes.h for the last commit to get rid of the inclusion
36
#include <drizzled/plugin.h>
1039.5.1 by Jay Pipes
* New serial event log plugin
37
#include <drizzled/gettext.h>
1143.2.10 by Jay Pipes
Phase 2 new replication work:
38
#include <drizzled/plugin/transaction_applier.h>
1039.5.1 by Jay Pipes
* New serial event log plugin
39
1237.9.3 by Padraig O'Sullivan
Removed one the includes I put in server_includes.h for the last commit to get rid of the inclusion
40
#include "default_replicator.h"
41
1039.5.1 by Jay Pipes
* New serial event log plugin
42
#include <vector>
43
#include <string>
44
45
using namespace std;
1039.5.39 by Jay Pipes
This patch does a couple things in preparation for publisher and
46
using namespace drizzled;
1039.5.1 by Jay Pipes
* New serial event log plugin
47
1405.3.1 by Jay Pipes
Adapts the plugin::TransactionReplicator and plugin::TransactionApplier
48
plugin::ReplicationReturnCode
49
DefaultReplicator::replicate(plugin::TransactionApplier *in_applier,
1405.3.7 by Jay Pipes
Change to non-const Session reference in replication API.
50
                             Session &in_session,
1405.3.1 by Jay Pipes
Adapts the plugin::TransactionReplicator and plugin::TransactionApplier
51
                             message::Transaction &to_replicate)
1039.5.1 by Jay Pipes
* New serial event log plugin
52
{
53
  /* 
54
   * We do absolutely nothing but call the applier's apply() method, passing
1143.2.10 by Jay Pipes
Phase 2 new replication work:
55
   * along the supplied Transaction.  Yep, told you it was simple...
1039.5.1 by Jay Pipes
* New serial event log plugin
56
   */
1405.3.3 by Jay Pipes
Adds Session reference to replication API
57
  return in_applier->apply(in_session, to_replicate);
1039.5.1 by Jay Pipes
* New serial event log plugin
58
}
59
60
static DefaultReplicator *default_replicator= NULL; /* The singleton replicator */
61
1530.2.6 by Monty Taylor
Moved plugin::Context to module::Context.
62
static int init(module::Context &context)
1039.5.1 by Jay Pipes
* New serial event log plugin
63
{
1130.2.6 by Monty Taylor
Merged in latest plugin-slot-reorg.
64
  default_replicator= new DefaultReplicator("default_replicator");
1324.2.2 by Monty Taylor
Use the plugin::Context everywhere.
65
  context.add(default_replicator);
1039.5.1 by Jay Pipes
* New serial event log plugin
66
  return 0;
67
}
68
1633.6.2 by Vijay Samuel
Reverted changes.
69
DRIZZLE_PLUGIN(init,  NULL, NULL);