~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/replication_services.h

This patch does a few things:

* Renames the TransactionServices component in the kernel
  to ReplicationServices.
* Renames the transaction.proto to replication proto and
  updates the various programs referencing drizzled/message/transaction.pb.h
* Adds a public method to the kernel's ReplicationServices component:
  getLastAppliedTimestamp() which returns the timestamp of the last Command message
  which was successfully sent to a registered Applier plugin (the Command was "applied")
* Updates ReplicationServices::push() method to update an atomic timestamp
  when a Command is successfully applied by a replicator to an applier.

The ReplicationServices::getLastAppliedTimestamp() is critical to the upcoming
Publisher plugin, as it allows the publisher to ask the kernel when the last Command
message was applied.

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_TRANSACTION_SERVICES_H
25
 
#define DRIZZLED_TRANSACTION_SERVICES_H
 
24
#ifndef DRIZZLED_REPLICATION_SERVICES_H
 
25
#define DRIZZLED_REPLICATION_SERVICES_H
26
26
 
27
27
#include "drizzled/atomics.h"
28
28
#include <vector>
57
57
 */
58
58
namespace drizzled
59
59
{
60
 
class TransactionServices
 
60
class ReplicationServices
61
61
{
62
62
public:
63
63
  static const size_t DEFAULT_RECORD_SIZE= 100;
67
67
   * or appliers are actually registered.
68
68
   */
69
69
  atomic<bool> is_active;
 
70
  /**
 
71
   * The timestamp of the last time a Command message was successfully
 
72
   * applied (sent to an Applier)
 
73
   */
 
74
  atomic<uint64_t> last_applied_timestamp;
70
75
  /** Our collection of replicator plugins */
71
76
  std::vector<drizzled::plugin::Replicator *> replicators;
72
77
  /** Our collection of applier plugins */
96
101
  /**
97
102
   * Constructor
98
103
   */
99
 
  TransactionServices();
 
104
  ReplicationServices();
100
105
  /**
101
 
   * Returns whether the TransactionServices object
 
106
   * Returns whether the ReplicationServices object
102
107
   * is active.  In other words, does it have both
103
108
   * a replicator and an applier that are *active*?
104
109
   */
195
200
   * @param Length of the query string
196
201
   */
197
202
  void rawStatement(Session *in_session, const char *in_query, size_t in_query_len);
 
203
  /**
 
204
   * Returns the timestamp of the last Command which was sent to 
 
205
   * an applier.
 
206
   */
 
207
  uint64_t getLastAppliedTimestamp() const;
198
208
};
199
209
 
200
210
} /* end namespace drizzled */
201
211
 
202
 
#endif /* DRIZZLED_TRANSACTION_SERVICES_H */
 
212
#endif /* DRIZZLED_REPLICATION_SERVICES_H */