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
|
|
5 |
*
|
|
6 |
* Authors:
|
|
7 |
*
|
|
8 |
* Jay Pipes <joinfu@sun.com>
|
|
9 |
*
|
|
10 |
* This program is free software; you can redistribute it and/or modify
|
|
11 |
* it under the terms of the GNU General Public License as published by
|
|
12 |
* the Free Software Foundation; version 2 of the License.
|
|
13 |
*
|
|
14 |
* This program is distributed in the hope that it will be useful,
|
|
15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17 |
* GNU General Public License for more details.
|
|
18 |
*
|
|
19 |
* You should have received a copy of the GNU General Public License
|
|
20 |
* along with this program; if not, write to the Free Software
|
|
21 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
22 |
*/
|
|
23 |
||
1039.5.39
by Jay Pipes
This patch does a couple things in preparation for publisher and |
24 |
#ifndef DRIZZLED_PLUGIN_COMMAND_APPLIER_H
|
25 |
#define DRIZZLED_PLUGIN_COMMAND_APPLIER_H
|
|
988.1.5
by Jay Pipes
Removal of log.cc (binlog), added Applier plugin and fixed up Replicator |
26 |
|
27 |
/**
|
|
1039.5.39
by Jay Pipes
This patch does a couple things in preparation for publisher and |
28 |
* @file Defines the API for a CommandApplier
|
988.1.5
by Jay Pipes
Removal of log.cc (binlog), added Applier plugin and fixed up Replicator |
29 |
*
|
1039.5.39
by Jay Pipes
This patch does a couple things in preparation for publisher and |
30 |
* A CommandApplier applies an event it has received from a CommandReplicator (via
|
31 |
* a replicator's replicate() call, or it has read using a CommandReader's read()
|
|
988.1.5
by Jay Pipes
Removal of log.cc (binlog), added Applier plugin and fixed up Replicator |
32 |
* call.
|
33 |
*/
|
|
34 |
||
35 |
/* some forward declarations needed */
|
|
36 |
namespace drizzled |
|
37 |
{
|
|
38 |
namespace message |
|
39 |
{
|
|
40 |
class Command; |
|
41 |
}
|
|
42 |
}
|
|
43 |
||
44 |
namespace drizzled |
|
45 |
{
|
|
46 |
namespace plugin |
|
47 |
{
|
|
48 |
||
49 |
/**
|
|
50 |
* Base class for appliers of Command messages
|
|
51 |
*/
|
|
1039.5.39
by Jay Pipes
This patch does a couple things in preparation for publisher and |
52 |
class CommandApplier |
988.1.5
by Jay Pipes
Removal of log.cc (binlog), added Applier plugin and fixed up Replicator |
53 |
{
|
54 |
public: |
|
1039.5.39
by Jay Pipes
This patch does a couple things in preparation for publisher and |
55 |
CommandApplier() {} |
56 |
virtual ~CommandApplier() {} |
|
988.1.5
by Jay Pipes
Removal of log.cc (binlog), added Applier plugin and fixed up Replicator |
57 |
/**
|
58 |
* Apply something to a target.
|
|
59 |
*
|
|
60 |
* @note
|
|
61 |
*
|
|
62 |
* It is important to note that memory allocation for the
|
|
63 |
* supplied pointer is not guaranteed after the completion
|
|
64 |
* of this function -- meaning the caller can dispose of the
|
|
65 |
* supplied message. Therefore, appliers which are
|
|
66 |
* implementing an asynchronous replication system must copy
|
|
67 |
* the supplied message to their own controlled memory storage
|
|
68 |
* area.
|
|
69 |
*
|
|
70 |
* @param Command message to be replicated
|
|
71 |
*/
|
|
1039.5.53
by Jay Pipes
Fixes based on Monty's code review. |
72 |
virtual void apply(const message::Command &to_apply)= 0; |
988.1.5
by Jay Pipes
Removal of log.cc (binlog), added Applier plugin and fixed up Replicator |
73 |
/**
|
74 |
* An applier plugin should override this with its
|
|
75 |
* internal method for determining if it is active or not.
|
|
76 |
*/
|
|
77 |
virtual bool isActive() {return false;} |
|
78 |
};
|
|
79 |
||
80 |
} /* end namespace drizzled::plugin */ |
|
81 |
} /* end namespace drizzled */ |
|
82 |
||
83 |
#endif /* DRIZZLED_PLUGIN_APPLIER_H */ |