2
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
4
* Copyright (C) 2008-2009 Sun Microsystems
5
* Copyright (c) 2010 Jay Pipes
9
* Jay Pipes <jaypipes@gmail.com>
8
* Jay Pipes <joinfu@sun.com>
11
10
* This program is free software; you can redistribute it and/or modify
12
11
* it under the terms of the GNU General Public License as published by
22
21
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
#ifndef DRIZZLED_PLUGIN_TRANSACTION_APPLIER_H
26
#define DRIZZLED_PLUGIN_TRANSACTION_APPLIER_H
24
#ifndef DRIZZLED_PLUGIN_COMMAND_APPLIER_H
25
#define DRIZZLED_PLUGIN_COMMAND_APPLIER_H
29
* @file Defines the API for a TransactionApplier
28
* @file Defines the API for a CommandApplier
31
* A TransactionApplier applies an event it has received from a TransactionReplicator (via
32
* a replicator's replicate() call, or it has read using a TransactionReader's read()
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()
36
35
#include "drizzled/plugin/plugin.h"
37
#include "drizzled/plugin/replication.h"
44
namespace message { class Transaction; }
40
namespace message { class Command; }
50
* Base class for appliers of Transaction messages
46
* Base class for appliers of Command messages
52
class TransactionApplier : public Plugin
48
class CommandApplier : public Plugin
55
TransactionApplier(const TransactionApplier &);
56
TransactionApplier& operator=(const TransactionApplier &);
51
CommandApplier(const CommandApplier &);
52
CommandApplier& operator=(const CommandApplier &);
58
explicit TransactionApplier(std::string name_arg)
59
: Plugin(name_arg, "TransactionApplier")
62
virtual ~TransactionApplier() {}
54
explicit CommandApplier(std::string name_arg) : Plugin(name_arg) {}
55
virtual ~CommandApplier() {}
64
57
* Apply something to a target.
73
66
* the supplied message to their own controlled memory storage
76
* @param Transaction message to be replicated
69
* @param Command message to be replicated
78
virtual ReplicationReturnCode apply(Session &in_session,
79
const message::Transaction &to_apply)= 0;
71
virtual void apply(const message::Command &to_apply)= 0;
81
static bool addPlugin(TransactionApplier *applier);
82
static void removePlugin(TransactionApplier *applier);
73
static bool addPlugin(CommandApplier *applier);
74
static void removePlugin(CommandApplier *applier);
85
77
} /* namespace plugin */
86
78
} /* namespace drizzled */
88
#endif /* DRIZZLED_PLUGIN_TRANSACTION_APPLIER_H */
80
#endif /* DRIZZLED_PLUGIN_APPLIER_H */