~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/transaction_replicator.h

  • Committer: Daniel Nichter
  • Date: 2011-10-23 16:01:37 UTC
  • mto: This revision was merged to the branch mainline in revision 2448.
  • Revision ID: daniel@percona.com-20111023160137-7ac3blgz8z4tf8za
Add Administration Getting Started and Logging.  Capitalize SQL clause keywords.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
 
3
 *
 
4
 *  Copyright (C) 2008-2009 Sun Microsystems, Inc.
 
5
 *  Copyright (C) 2010 Jay Pipes
 
6
 *
 
7
 *  Authors:
 
8
 *
 
9
 *    Jay Pipes <jaypipes@gmail.com>
 
10
 *
 
11
 *  This program is free software; you can redistribute it and/or modify
 
12
 *  it under the terms of the GNU General Public License as published by
 
13
 *  the Free Software Foundation; version 2 of the License.
 
14
 *
 
15
 *  This program is distributed in the hope that it will be useful,
 
16
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
18
 *  GNU General Public License for more details.
 
19
 *
 
20
 *  You should have received a copy of the GNU General Public License
 
21
 *  along with this program; if not, write to the Free Software
 
22
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
23
 */
 
24
 
 
25
#pragma once
 
26
 
 
27
#include <drizzled/plugin/replication.h>
 
28
#include <drizzled/plugin/plugin.h>
 
29
 
 
30
#include <drizzled/visibility.h>
 
31
 
 
32
/**
 
33
 * @file Defines the API for a TransactionReplicator.  
 
34
 *
 
35
 * All a replicator does is replicate/reproduce
 
36
 * events, optionally transforming them before sending them off to a TransactionApplier.
 
37
 *
 
38
 * An applier is responsible for applying events, not a replicator...
 
39
 */
 
40
 
 
41
namespace drizzled {
 
42
namespace plugin {
 
43
 
 
44
/**
 
45
 * Class which replicates Transaction messages
 
46
 */
 
47
class DRIZZLED_API TransactionReplicator : public Plugin
 
48
{
 
49
public:
 
50
  explicit TransactionReplicator(std::string name_arg)
 
51
    : Plugin(name_arg, "TransactionReplicator")
 
52
  {
 
53
  }
 
54
 
 
55
  /**
 
56
   * Replicate a Transaction message to a TransactionApplier.
 
57
   *
 
58
   * @note
 
59
   *
 
60
   * It is important to note that memory allocation for the 
 
61
   * supplied pointer is not guaranteed after the completion 
 
62
   * of this function -- meaning the caller can dispose of the
 
63
   * supplied message.  Therefore, replicators and appliers 
 
64
   * implementing an asynchronous replication system must copy
 
65
   * the supplied message to their own controlled memory storage
 
66
   * area.
 
67
   *
 
68
   * @param Pointer to the applier of the command message
 
69
   * @param Transaction message to be replicated
 
70
   */
 
71
  virtual ReplicationReturnCode replicate(TransactionApplier *in_applier, 
 
72
                                          Session &session,
 
73
                                          message::Transaction &to_replicate)= 0;
 
74
  static bool addPlugin(TransactionReplicator *replicator);
 
75
  static void removePlugin(TransactionReplicator *replicator);
 
76
};
 
77
 
 
78
} /* namespace plugin */
 
79
} /* namespace drizzled */
 
80