~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/transaction_replicator.h

  • Committer: Brian Aker
  • Date: 2010-01-22 00:53:13 UTC
  • Revision ID: brian@gaz-20100122005313-jmizcbcdi1lt4tcx
Revert db patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008-2009 Sun Microsystems, Inc.
5
 
 *  Copyright (C) 2010 Jay Pipes
 
4
 *  Copyright (C) 2008-2009 Sun Microsystems
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>
30
 
 
31
 
#include <drizzled/visibility.h>
 
27
#include "drizzled/atomics.h"
 
28
#include "drizzled/plugin/plugin.h"
32
29
 
33
30
/**
34
31
 * @file Defines the API for a TransactionReplicator.  
39
36
 * An applier is responsible for applying events, not a replicator...
40
37
 */
41
38
 
 
39
 
42
40
namespace drizzled
43
41
{
44
42
namespace message
47
45
  class Statement;
48
46
}
49
47
 
50
 
class Session;
51
 
 
52
48
namespace plugin
53
49
{
54
50
 
57
53
/**
58
54
 * Class which replicates Transaction messages
59
55
 */
60
 
class DRIZZLED_API TransactionReplicator : public Plugin
 
56
class TransactionReplicator : public Plugin
61
57
{
62
58
  TransactionReplicator();
63
59
  TransactionReplicator(const TransactionReplicator &);
64
60
  TransactionReplicator& operator=(const TransactionReplicator &);
 
61
  atomic<bool> is_enabled;
65
62
public:
66
63
  explicit TransactionReplicator(std::string name_arg)
67
64
    : Plugin(name_arg, "TransactionReplicator")
68
65
  {
 
66
    is_enabled= true;
69
67
  }
70
68
  virtual ~TransactionReplicator() {}
71
69
 
85
83
   * @param Pointer to the applier of the command message
86
84
   * @param Transaction message to be replicated
87
85
   */
88
 
  virtual ReplicationReturnCode replicate(TransactionApplier *in_applier, 
89
 
                                          Session &session,
90
 
                                          message::Transaction &to_replicate)= 0;
 
86
  virtual void replicate(TransactionApplier *in_applier, 
 
87
                         message::Transaction &to_replicate)= 0;
91
88
  static bool addPlugin(TransactionReplicator *replicator);
92
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
  }
93
105
};
94
106
 
95
107
} /* namespace plugin */