~posulliv/drizzle/optimizer-style-cleanup

« back to all changes in this revision

Viewing changes to drizzled/plugin/transaction_replicator.h

  • Committer: Padraig O'Sullivan
  • Date: 2010-04-17 01:38:47 UTC
  • mfrom: (1237.9.238 bad-staging)
  • Revision ID: osullivan.padraig@gmail.com-20100417013847-ibjioqsfbmf5yg4g
Merge trunk.

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
5
6
 *
6
7
 *  Authors:
7
8
 *
8
 
 *    Jay Pipes <joinfu@sun.com>
 
9
 *    Jay Pipes <jaypipes@gmail.com>
9
10
 *
10
11
 *  This program is free software; you can redistribute it and/or modify
11
12
 *  it under the terms of the GNU General Public License as published by
24
25
#ifndef DRIZZLED_PLUGIN_TRANSACTION_REPLICATOR_H
25
26
#define DRIZZLED_PLUGIN_TRANSACTION_REPLICATOR_H
26
27
 
27
 
#include "drizzled/atomics.h"
 
28
#include "drizzled/plugin/replication.h"
28
29
#include "drizzled/plugin/plugin.h"
29
30
 
30
31
/**
36
37
 * An applier is responsible for applying events, not a replicator...
37
38
 */
38
39
 
39
 
 
40
40
namespace drizzled
41
41
{
42
42
namespace message
45
45
  class Statement;
46
46
}
47
47
 
 
48
class Session;
 
49
 
48
50
namespace plugin
49
51
{
50
52
 
58
60
  TransactionReplicator();
59
61
  TransactionReplicator(const TransactionReplicator &);
60
62
  TransactionReplicator& operator=(const TransactionReplicator &);
61
 
  atomic<bool> is_enabled;
62
63
public:
63
64
  explicit TransactionReplicator(std::string name_arg)
64
65
    : Plugin(name_arg, "TransactionReplicator")
65
66
  {
66
 
    is_enabled= true;
67
67
  }
68
68
  virtual ~TransactionReplicator() {}
69
69
 
83
83
   * @param Pointer to the applier of the command message
84
84
   * @param Transaction message to be replicated
85
85
   */
86
 
  virtual void replicate(TransactionApplier *in_applier, 
87
 
                         message::Transaction &to_replicate)= 0;
 
86
  virtual ReplicationReturnCode replicate(TransactionApplier *in_applier, 
 
87
                                          Session &session,
 
88
                                          message::Transaction &to_replicate)= 0;
88
89
  static bool addPlugin(TransactionReplicator *replicator);
89
90
  static void removePlugin(TransactionReplicator *replicator);
90
 
 
91
 
  virtual bool isEnabled() const
92
 
  {
93
 
    return is_enabled;
94
 
  }
95
 
 
96
 
  virtual void enable()
97
 
  {
98
 
    is_enabled= true;
99
 
  }
100
 
 
101
 
  virtual void disable()
102
 
  {
103
 
    is_enabled= false;
104
 
  }
105
91
};
106
92
 
107
93
} /* namespace plugin */