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
8
* Jay Pipes <joinfu@sun.com>
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.
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.
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
24
#ifndef DRIZZLED_PLUGIN_COMMAND_REPLICATOR_H
25
#define DRIZZLED_PLUGIN_COMMAND_REPLICATOR_H
28
* @file Defines the API for a CommandReplicator.
30
* All a replicator does is replicate/reproduce
31
* events, optionally transforming them before sending them off to a CommandApplier.
33
* An applier is responsible for applying events, not a replicator...
36
/* some forward declarations needed */
53
* Class which replicates Command messages
55
class CommandReplicator
58
CommandReplicator() {}
59
virtual ~CommandReplicator() {}
61
* Replicate a Command message to a CommandApplier.
65
* It is important to note that memory allocation for the
66
* supplied pointer is not guaranteed after the completion
67
* of this function -- meaning the caller can dispose of the
68
* supplied message. Therefore, replicators and appliers
69
* implementing an asynchronous replication system must copy
70
* the supplied message to their own controlled memory storage
73
* @param Pointer to the applier of the command message
74
* @param Command message to be replicated
76
virtual void replicate(CommandApplier *in_applier,
77
message::Command &to_replicate)= 0;
79
* A replicator plugin should override this with its
80
* internal method for determining if it is active or not.
82
virtual bool isActive() {return false;}
85
} /* end namespace drizzled::plugin */
86
} /* end namespace drizzled */
88
#endif /* DRIZZLED_PLUGIN_COMMAND_REPLICATOR_H */