988.1.5
by Jay Pipes
Removal of log.cc (binlog), added Applier plugin and fixed up Replicator |
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
|
|
1405.3.1
by Jay Pipes
Adapts the plugin::TransactionReplicator and plugin::TransactionApplier |
5 |
* Copyright (c) 2010 Jay Pipes
|
988.1.5
by Jay Pipes
Removal of log.cc (binlog), added Applier plugin and fixed up Replicator |
6 |
*
|
7 |
* Authors:
|
|
8 |
*
|
|
1405.3.1
by Jay Pipes
Adapts the plugin::TransactionReplicator and plugin::TransactionApplier |
9 |
* Jay Pipes <jaypipes@gmail.com>
|
988.1.5
by Jay Pipes
Removal of log.cc (binlog), added Applier plugin and fixed up Replicator |
10 |
*
|
11 |
* This program is free software; you can redistribute it and/or modify
|
|
12 |
* it under the terms of the GNU General Public License as published by
|
|
13 |
* the Free Software Foundation; version 2 of the License.
|
|
14 |
*
|
|
15 |
* This program is distributed in the hope that it will be useful,
|
|
16 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
17 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
18 |
* GNU General Public License for more details.
|
|
19 |
*
|
|
20 |
* You should have received a copy of the GNU General Public License
|
|
21 |
* along with this program; if not, write to the Free Software
|
|
22 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
23 |
*/
|
|
636.1.1
by Mark Atwood
add replicator plugin type |
24 |
|
1143.2.10
by Jay Pipes
Phase 2 new replication work: |
25 |
#ifndef DRIZZLED_PLUGIN_TRANSACTION_REPLICATOR_H
|
26 |
#define DRIZZLED_PLUGIN_TRANSACTION_REPLICATOR_H
|
|
636.1.1
by Mark Atwood
add replicator plugin type |
27 |
|
1405.3.1
by Jay Pipes
Adapts the plugin::TransactionReplicator and plugin::TransactionApplier |
28 |
#include "drizzled/plugin/replication.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 |
29 |
#include "drizzled/plugin/plugin.h" |
1130.2.29
by Monty Taylor
Removed runtime active flag from plugin::Plugin. Put a runtime enabled flag on CommandApplier and CommandReplicator - we can refactor this down into plugin::Plugin later if we need to. |
30 |
|
960.4.1
by Monty Taylor
Changed replicator plugins to class based. |
31 |
/**
|
1143.2.10
by Jay Pipes
Phase 2 new replication work: |
32 |
* @file Defines the API for a TransactionReplicator.
|
988.1.5
by Jay Pipes
Removal of log.cc (binlog), added Applier plugin and fixed up Replicator |
33 |
*
|
34 |
* All a replicator does is replicate/reproduce
|
|
1143.2.10
by Jay Pipes
Phase 2 new replication work: |
35 |
* events, optionally transforming them before sending them off to a TransactionApplier.
|
988.1.5
by Jay Pipes
Removal of log.cc (binlog), added Applier plugin and fixed up Replicator |
36 |
*
|
37 |
* An applier is responsible for applying events, not a replicator...
|
|
960.4.1
by Monty Taylor
Changed replicator plugins to class based. |
38 |
*/
|
39 |
||
1130.1.12
by Monty Taylor
Moved service stuff into plugin/ |
40 |
namespace drizzled |
41 |
{
|
|
1143.2.10
by Jay Pipes
Phase 2 new replication work: |
42 |
namespace message |
43 |
{
|
|
44 |
class Transaction; |
|
45 |
class Statement; |
|
46 |
}
|
|
1130.1.12
by Monty Taylor
Moved service stuff into plugin/ |
47 |
|
1405.3.3
by Jay Pipes
Adds Session reference to replication API |
48 |
class Session; |
49 |
||
988.1.5
by Jay Pipes
Removal of log.cc (binlog), added Applier plugin and fixed up Replicator |
50 |
namespace plugin |
51 |
{
|
|
52 |
||
1143.2.10
by Jay Pipes
Phase 2 new replication work: |
53 |
class TransactionApplier; |
1039.5.39
by Jay Pipes
This patch does a couple things in preparation for publisher and |
54 |
|
960.4.1
by Monty Taylor
Changed replicator plugins to class based. |
55 |
/**
|
1143.2.10
by Jay Pipes
Phase 2 new replication work: |
56 |
* Class which replicates Transaction messages
|
960.4.1
by Monty Taylor
Changed replicator plugins to class based. |
57 |
*/
|
1143.2.18
by Jay Pipes
Merge trunk and resolve conflicts. |
58 |
class TransactionReplicator : public Plugin |
636.1.1
by Mark Atwood
add replicator plugin type |
59 |
{
|
1143.2.18
by Jay Pipes
Merge trunk and resolve conflicts. |
60 |
TransactionReplicator(); |
61 |
TransactionReplicator(const TransactionReplicator &); |
|
62 |
TransactionReplicator& operator=(const TransactionReplicator &); |
|
960.4.1
by Monty Taylor
Changed replicator plugins to class based. |
63 |
public: |
1143.2.18
by Jay Pipes
Merge trunk and resolve conflicts. |
64 |
explicit TransactionReplicator(std::string name_arg) |
1192.2.6
by Monty Taylor
Merged trunk. |
65 |
: Plugin(name_arg, "TransactionReplicator") |
1130.2.29
by Monty Taylor
Removed runtime active flag from plugin::Plugin. Put a runtime enabled flag on CommandApplier and CommandReplicator - we can refactor this down into plugin::Plugin later if we need to. |
66 |
{
|
67 |
}
|
|
1143.2.10
by Jay Pipes
Phase 2 new replication work: |
68 |
virtual ~TransactionReplicator() {} |
1130.2.29
by Monty Taylor
Removed runtime active flag from plugin::Plugin. Put a runtime enabled flag on CommandApplier and CommandReplicator - we can refactor this down into plugin::Plugin later if we need to. |
69 |
|
960.4.1
by Monty Taylor
Changed replicator plugins to class based. |
70 |
/**
|
1143.2.10
by Jay Pipes
Phase 2 new replication work: |
71 |
* Replicate a Transaction message to a TransactionApplier.
|
988.1.5
by Jay Pipes
Removal of log.cc (binlog), added Applier plugin and fixed up Replicator |
72 |
*
|
73 |
* @note
|
|
74 |
*
|
|
75 |
* It is important to note that memory allocation for the
|
|
76 |
* supplied pointer is not guaranteed after the completion
|
|
77 |
* of this function -- meaning the caller can dispose of the
|
|
78 |
* supplied message. Therefore, replicators and appliers
|
|
79 |
* implementing an asynchronous replication system must copy
|
|
80 |
* the supplied message to their own controlled memory storage
|
|
81 |
* area.
|
|
82 |
*
|
|
1039.5.39
by Jay Pipes
This patch does a couple things in preparation for publisher and |
83 |
* @param Pointer to the applier of the command message
|
1143.2.10
by Jay Pipes
Phase 2 new replication work: |
84 |
* @param Transaction message to be replicated
|
988.1.5
by Jay Pipes
Removal of log.cc (binlog), added Applier plugin and fixed up Replicator |
85 |
*/
|
1405.3.1
by Jay Pipes
Adapts the plugin::TransactionReplicator and plugin::TransactionApplier |
86 |
virtual ReplicationReturnCode replicate(TransactionApplier *in_applier, |
1405.3.7
by Jay Pipes
Change to non-const Session reference in replication API. |
87 |
Session &session, |
1405.3.1
by Jay Pipes
Adapts the plugin::TransactionReplicator and plugin::TransactionApplier |
88 |
message::Transaction &to_replicate)= 0; |
1143.2.10
by Jay Pipes
Phase 2 new replication work: |
89 |
static bool addPlugin(TransactionReplicator *replicator); |
90 |
static void removePlugin(TransactionReplicator *replicator); |
|
960.4.1
by Monty Taylor
Changed replicator plugins to class based. |
91 |
};
|
636.1.1
by Mark Atwood
add replicator plugin type |
92 |
|
1130.1.12
by Monty Taylor
Moved service stuff into plugin/ |
93 |
} /* namespace plugin */ |
94 |
} /* namespace drizzled */ |
|
988.1.5
by Jay Pipes
Removal of log.cc (binlog), added Applier plugin and fixed up Replicator |
95 |
|
1143.2.10
by Jay Pipes
Phase 2 new replication work: |
96 |
#endif /* DRIZZLED_PLUGIN_TRANSACTION_REPLICATOR_H */ |