21
21
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
#ifndef DRIZZLED_PLUGIN_TRANSACTION_REPLICATOR_H
25
#define DRIZZLED_PLUGIN_TRANSACTION_REPLICATOR_H
27
#include "drizzled/atomics.h"
28
#include "drizzled/plugin/plugin.h"
24
#ifndef DRIZZLED_PLUGIN_REPLICATOR_H
25
#define DRIZZLED_PLUGIN_REPLICATOR_H
31
* @file Defines the API for a TransactionReplicator.
28
* @file Defines the API for a Replicator.
33
30
* All a replicator does is replicate/reproduce
34
* events, optionally transforming them before sending them off to a TransactionApplier.
31
* events, optionally transforming them before sending them off to an applier.
36
33
* An applier is responsible for applying events, not a replicator...
36
/* some forward declarations needed */
51
class TransactionApplier;
54
* Class which replicates Transaction messages
52
* Class which replicates Command messages
56
class TransactionReplicator : public Plugin
58
TransactionReplicator();
59
TransactionReplicator(const TransactionReplicator &);
60
TransactionReplicator& operator=(const TransactionReplicator &);
61
atomic<bool> is_enabled;
63
explicit TransactionReplicator(std::string name_arg)
64
: Plugin(name_arg, "TransactionReplicator")
68
virtual ~TransactionReplicator() {}
58
virtual ~Replicator() {}
71
* Replicate a Transaction message to a TransactionApplier.
60
* Replicate a Command message to an Applier.
80
69
* the supplied message to their own controlled memory storage
83
* @param Pointer to the applier of the command message
84
* @param Transaction message to be replicated
86
virtual void replicate(TransactionApplier *in_applier,
87
message::Transaction &to_replicate)= 0;
88
static bool addPlugin(TransactionReplicator *replicator);
89
static void removePlugin(TransactionReplicator *replicator);
91
virtual bool isEnabled() const
101
virtual void disable()
72
* @param Command message to be replicated
74
virtual void replicate(Applier *in_applier, drizzled::message::Command *to_replicate)= 0;
76
* A replicator plugin should override this with its
77
* internal method for determining if it is active or not.
79
virtual bool isActive() {return false;}
107
} /* namespace plugin */
108
} /* namespace drizzled */
82
} /* end namespace drizzled::plugin */
83
} /* end namespace drizzled */
110
#endif /* DRIZZLED_PLUGIN_TRANSACTION_REPLICATOR_H */
85
#endif /* DRIZZLED_PLUGIN_REPLICATOR_H */