~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/transaction_replicator.h

New merge for TableShare

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"
29
 
#include "drizzled/plugin/plugin.h"
 
27
#include "drizzled/atomics.h"
30
28
 
31
29
/**
32
30
 * @file Defines the API for a TransactionReplicator.  
37
35
 * An applier is responsible for applying events, not a replicator...
38
36
 */
39
37
 
 
38
 
40
39
namespace drizzled
41
40
{
42
41
namespace message
45
44
  class Statement;
46
45
}
47
46
 
48
 
class Session;
49
 
 
50
47
namespace plugin
51
48
{
52
49
 
60
57
  TransactionReplicator();
61
58
  TransactionReplicator(const TransactionReplicator &);
62
59
  TransactionReplicator& operator=(const TransactionReplicator &);
 
60
  atomic<bool> is_enabled;
63
61
public:
64
62
  explicit TransactionReplicator(std::string name_arg)
65
63
    : Plugin(name_arg, "TransactionReplicator")
66
64
  {
 
65
    is_enabled= true;
67
66
  }
68
67
  virtual ~TransactionReplicator() {}
69
68
 
83
82
   * @param Pointer to the applier of the command message
84
83
   * @param Transaction message to be replicated
85
84
   */
86
 
  virtual ReplicationReturnCode replicate(TransactionApplier *in_applier, 
87
 
                                          Session &session,
88
 
                                          message::Transaction &to_replicate)= 0;
 
85
  virtual void replicate(TransactionApplier *in_applier, 
 
86
                         message::Transaction &to_replicate)= 0;
89
87
  static bool addPlugin(TransactionReplicator *replicator);
90
88
  static void removePlugin(TransactionReplicator *replicator);
 
89
 
 
90
  virtual bool isEnabled() const
 
91
  {
 
92
    return is_enabled;
 
93
  }
 
94
 
 
95
  virtual void enable()
 
96
  {
 
97
    is_enabled= true;
 
98
  }
 
99
 
 
100
  virtual void disable()
 
101
  {
 
102
    is_enabled= false;
 
103
  }
91
104
};
92
105
 
93
106
} /* namespace plugin */