~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/transaction_replicator.h

  • Committer: Brian Aker
  • Date: 2010-03-19 01:45:39 UTC
  • mto: This revision was merged to the branch mainline in revision 1362.
  • Revision ID: brian@gaz-20100319014539-jv38vkd8h9a4axzr
Another pass through the interface...

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
25
24
#ifndef DRIZZLED_PLUGIN_TRANSACTION_REPLICATOR_H
26
25
#define DRIZZLED_PLUGIN_TRANSACTION_REPLICATOR_H
27
26
 
28
 
#include "drizzled/plugin/replication.h"
 
27
#include "drizzled/atomics.h"
29
28
#include "drizzled/plugin/plugin.h"
30
29
 
31
30
/**
37
36
 * An applier is responsible for applying events, not a replicator...
38
37
 */
39
38
 
 
39
 
40
40
namespace drizzled
41
41
{
42
42
namespace message
45
45
  class Statement;
46
46
}
47
47
 
48
 
class Session;
49
 
 
50
48
namespace plugin
51
49
{
52
50
 
60
58
  TransactionReplicator();
61
59
  TransactionReplicator(const TransactionReplicator &);
62
60
  TransactionReplicator& operator=(const TransactionReplicator &);
 
61
  atomic<bool> is_enabled;
63
62
public:
64
63
  explicit TransactionReplicator(std::string name_arg)
65
64
    : Plugin(name_arg, "TransactionReplicator")
66
65
  {
 
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 ReplicationReturnCode replicate(TransactionApplier *in_applier, 
87
 
                                          Session &session,
88
 
                                          message::Transaction &to_replicate)= 0;
 
86
  virtual void replicate(TransactionApplier *in_applier, 
 
87
                         message::Transaction &to_replicate)= 0;
89
88
  static bool addPlugin(TransactionReplicator *replicator);
90
89
  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
  }
91
105
};
92
106
 
93
107
} /* namespace plugin */