~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/replicator.h

  • Committer: Brian Aker
  • Date: 2009-06-03 19:30:45 UTC
  • mfrom: (1046.1.6 merge)
  • Revision ID: brian@gaz-20090603193045-4xgeczyfixh07beg
MergeĀ forĀ Brian

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
4
 *  Copyright (C) 2008-2009 Sun Microsystems
5
 
 *  Copyright (c) 2010 Jay Pipes
6
5
 *
7
6
 *  Authors:
8
7
 *
9
 
 *    Jay Pipes <jaypipes@gmail.com>
 
8
 *    Jay Pipes <joinfu@sun.com>
10
9
 *
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
23
22
 */
24
23
 
25
 
#ifndef DRIZZLED_PLUGIN_TRANSACTION_REPLICATOR_H
26
 
#define DRIZZLED_PLUGIN_TRANSACTION_REPLICATOR_H
27
 
 
28
 
#include "drizzled/plugin/replication.h"
29
 
#include "drizzled/plugin/plugin.h"
 
24
#ifndef DRIZZLED_PLUGIN_REPLICATOR_H
 
25
#define DRIZZLED_PLUGIN_REPLICATOR_H
30
26
 
31
27
/**
32
 
 * @file Defines the API for a TransactionReplicator.  
 
28
 * @file Defines the API for a Replicator.  
33
29
 *
34
30
 * All a replicator does is replicate/reproduce
35
 
 * events, optionally transforming them before sending them off to a TransactionApplier.
 
31
 * events, optionally transforming them before sending them off to an applier.
36
32
 *
37
33
 * An applier is responsible for applying events, not a replicator...
38
34
 */
39
35
 
 
36
/* some forward declarations needed */
40
37
namespace drizzled
41
38
{
42
 
namespace message
43
 
44
 
  class Transaction;
45
 
  class Statement;
 
39
  namespace message
 
40
  {
 
41
    class Command;
 
42
  }
 
43
  class Applier;
46
44
}
47
45
 
48
 
class Session;
49
 
 
 
46
namespace drizzled
 
47
{
50
48
namespace plugin
51
49
{
52
50
 
53
 
class TransactionApplier;
54
 
 
55
51
/**
56
 
 * Class which replicates Transaction messages
 
52
 * Class which replicates Command messages
57
53
 */
58
 
class TransactionReplicator : public Plugin
 
54
class Replicator
59
55
{
60
 
  TransactionReplicator();
61
 
  TransactionReplicator(const TransactionReplicator &);
62
 
  TransactionReplicator& operator=(const TransactionReplicator &);
63
56
public:
64
 
  explicit TransactionReplicator(std::string name_arg)
65
 
    : Plugin(name_arg, "TransactionReplicator")
66
 
  {
67
 
  }
68
 
  virtual ~TransactionReplicator() {}
69
 
 
 
57
  Replicator() {}
 
58
  virtual ~Replicator() {}
70
59
  /**
71
 
   * Replicate a Transaction message to a TransactionApplier.
 
60
   * Replicate a Command message to an Applier.
72
61
   *
73
62
   * @note
74
63
   *
80
69
   * the supplied message to their own controlled memory storage
81
70
   * area.
82
71
   *
83
 
   * @param Pointer to the applier of the command message
84
 
   * @param Transaction message to be replicated
85
 
   */
86
 
  virtual ReplicationReturnCode replicate(TransactionApplier *in_applier, 
87
 
                                          Session &session,
88
 
                                          message::Transaction &to_replicate)= 0;
89
 
  static bool addPlugin(TransactionReplicator *replicator);
90
 
  static void removePlugin(TransactionReplicator *replicator);
 
72
   * @param Command message to be replicated
 
73
   */
 
74
  virtual void replicate(Applier *in_applier, drizzled::message::Command *to_replicate)= 0;
 
75
  /** 
 
76
   * A replicator plugin should override this with its
 
77
   * internal method for determining if it is active or not.
 
78
   */
 
79
  virtual bool isActive() {return false;}
91
80
};
92
81
 
93
 
} /* namespace plugin */
94
 
} /* namespace drizzled */
 
82
} /* end namespace drizzled::plugin */
 
83
} /* end namespace drizzled */
95
84
 
96
 
#endif /* DRIZZLED_PLUGIN_TRANSACTION_REPLICATOR_H */
 
85
#endif /* DRIZZLED_PLUGIN_REPLICATOR_H */