~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/transaction_replicator.h

  • Committer: Jay Pipes
  • Date: 2009-10-07 23:59:47 UTC
  • mto: (1234.1.1 push) (1237.2.10 push)
  • mto: This revision was merged to the branch mainline in revision 1193.
  • Revision ID: jpipes@serialcoder-20091007235947-18simrecnzwv8t1q
Phase 2 new replication work:

* Removes old replication.proto file, old command_transform library
* Removes use of korr.h macro calls in favor of GPB's CodedOutputStream
  API.
* Updates transaction_log, default_replicator, and filtered_replicator module
  to use new Transaction message.
* Updates ReplicationServices to construct the new Transaction messages and
  associated Statement sub-messages
* Corrects transaction boundaries.  AUTOCOMMIT now works properly, and I have
  added a new test case to verify AUTOCOMMIT variable modification of the way
  in which Transaction messages are bundled up and sent across to replicators.

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_REPLICATOR_H
25
 
#define DRIZZLED_PLUGIN_COMMAND_REPLICATOR_H
 
24
#ifndef DRIZZLED_PLUGIN_TRANSACTION_REPLICATOR_H
 
25
#define DRIZZLED_PLUGIN_TRANSACTION_REPLICATOR_H
26
26
 
27
27
/**
28
 
 * @file Defines the API for a CommandReplicator.  
 
28
 * @file Defines the API for a TransactionReplicator.  
29
29
 *
30
30
 * All a replicator does is replicate/reproduce
31
 
 * events, optionally transforming them before sending them off to a CommandApplier.
 
31
 * events, optionally transforming them before sending them off to a TransactionApplier.
32
32
 *
33
33
 * An applier is responsible for applying events, not a replicator...
34
34
 */
36
36
 
37
37
namespace drizzled
38
38
{
39
 
namespace message { class Command; }
 
39
namespace message
 
40
 
41
  class Transaction;
 
42
  class Statement;
 
43
}
40
44
 
41
45
namespace plugin
42
46
{
43
47
 
44
 
class CommandApplier;
 
48
class TransactionApplier;
45
49
 
46
50
/**
47
 
 * Class which replicates Command messages
 
51
 * Class which replicates Transaction messages
48
52
 */
49
 
class CommandReplicator
 
53
class TransactionReplicator
50
54
{
51
55
public:
52
 
  CommandReplicator() {}
53
 
  virtual ~CommandReplicator() {}
 
56
  TransactionReplicator() {}
 
57
  virtual ~TransactionReplicator() {}
54
58
  /**
55
 
   * Replicate a Command message to a CommandApplier.
 
59
   * Replicate a Transaction message to a TransactionApplier.
56
60
   *
57
61
   * @note
58
62
   *
65
69
   * area.
66
70
   *
67
71
   * @param Pointer to the applier of the command message
68
 
   * @param Command message to be replicated
 
72
   * @param Transaction message to be replicated
69
73
   */
70
 
  virtual void replicate(CommandApplier *in_applier, 
71
 
                         message::Command &to_replicate)= 0;
 
74
  virtual void replicate(TransactionApplier *in_applier, 
 
75
                         message::Transaction &to_replicate)= 0;
72
76
  /** 
73
77
   * A replicator plugin should override this with its
74
78
   * internal method for determining if it is active or not.
75
79
   */
76
80
  virtual bool isActive() {return false;}
77
81
 
78
 
  static bool addPlugin(CommandReplicator *replicator);
79
 
  static void removePlugin(CommandReplicator *replicator);
 
82
  static bool addPlugin(TransactionReplicator *replicator);
 
83
  static void removePlugin(TransactionReplicator *replicator);
80
84
};
81
85
 
82
86
} /* namespace plugin */
83
87
} /* namespace drizzled */
84
88
 
85
 
#endif /* DRIZZLED_PLUGIN_COMMAND_REPLICATOR_H */
 
89
#endif /* DRIZZLED_PLUGIN_TRANSACTION_REPLICATOR_H */