~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/transaction_applier.h

Added code necessary for building plugins dynamically.
Merged in changes from lifeless to allow autoreconf to work.
Touching plugin.ini files now triggers a rebuid - so config/autorun.sh is no
longer required to be run after touching those.
Removed the duplicate plugin names - also removed the issue that getting them
different would silently fail weirdly later.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22
22
 */
23
23
 
24
 
#ifndef DRIZZLED_PLUGIN_COMMAND_APPLIER_H
25
 
#define DRIZZLED_PLUGIN_COMMAND_APPLIER_H
 
24
#ifndef DRIZZLED_PLUGIN_TRANSACTION_APPLIER_H
 
25
#define DRIZZLED_PLUGIN_TRANSACTION_APPLIER_H
26
26
 
27
27
/**
28
 
 * @file Defines the API for a CommandApplier
 
28
 * @file Defines the API for a TransactionApplier
29
29
 *
30
 
 * A CommandApplier applies an event it has received from a CommandReplicator
31
 
 * (via a replicator's replicate() call, or it has read using a CommandReader's
32
 
 * read() call.
 
30
 * A TransactionApplier applies an event it has received from a TransactionReplicator (via 
 
31
 * a replicator's replicate() call, or it has read using a TransactionReader's read()
 
32
 * call.
33
33
 */
34
34
 
35
35
#include "drizzled/plugin/plugin.h"
38
38
namespace drizzled
39
39
{
40
40
 
41
 
namespace message { class Command; }
 
41
namespace message { class Transaction; }
42
42
 
43
43
namespace plugin
44
44
{
45
45
 
46
46
/**
47
 
 * Base class for appliers of Command messages
 
47
 * Base class for appliers of Transaction messages
48
48
 */
49
 
class CommandApplier : public Plugin
 
49
class TransactionApplier : public Plugin
50
50
{
51
 
  CommandApplier();
52
 
  CommandApplier(const CommandApplier &);
53
 
  CommandApplier& operator=(const CommandApplier &);
 
51
  TransactionApplier();
 
52
  TransactionApplier(const TransactionApplier &);
 
53
  TransactionApplier& operator=(const TransactionApplier &);
54
54
  atomic<bool> is_enabled;
55
 
 
56
55
public:
57
 
  explicit CommandApplier(std::string name_arg)
58
 
    : Plugin(name_arg)
 
56
  explicit TransactionApplier(std::string name_arg)
 
57
    : Plugin(name_arg, "TransactionApplier")
59
58
  {
60
59
    is_enabled= true;
61
60
  }
62
 
 
63
 
  virtual ~CommandApplier() {}
64
 
 
 
61
  virtual ~TransactionApplier() {}
65
62
  /**
66
63
   * Apply something to a target.
67
64
   *
75
72
   * the supplied message to their own controlled memory storage
76
73
   * area.
77
74
   *
78
 
   * @param Command message to be replicated
 
75
   * @param Transaction message to be replicated
79
76
   */
80
 
  virtual void apply(const message::Command &to_apply)= 0;
 
77
  virtual void apply(const message::Transaction &to_apply)= 0;
81
78
 
 
79
  static bool addPlugin(TransactionApplier *applier);
 
80
  static void removePlugin(TransactionApplier *applier);
82
81
  virtual bool isEnabled() const
83
82
  {
84
83
    return is_enabled;
93
92
  {
94
93
    is_enabled= false;
95
94
  }
96
 
 
97
 
 
98
 
  static bool addPlugin(CommandApplier *applier);
99
 
  static void removePlugin(CommandApplier *applier);
100
95
};
101
96
 
102
97
} /* namespace plugin */
103
98
} /* namespace drizzled */
104
99
 
105
 
#endif /* DRIZZLED_PLUGIN_COMMAND_APPLIER_H */
 
100
#endif /* DRIZZLED_PLUGIN_TRANSACTION_APPLIER_H */