~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/transaction_applier.h

Merged vcol stuff.

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
 
#ifndef DRIZZLED_PLUGIN_TRANSACTION_APPLIER_H
26
 
#define DRIZZLED_PLUGIN_TRANSACTION_APPLIER_H
27
 
 
28
 
/**
29
 
 * @file Defines the API for a TransactionApplier
30
 
 *
31
 
 * A TransactionApplier applies an event it has received from a TransactionReplicator (via 
32
 
 * a replicator's replicate() call, or it has read using a TransactionReader's read()
33
 
 * call.
34
 
 */
35
 
 
36
 
#include "drizzled/plugin/plugin.h"
37
 
#include "drizzled/plugin/replication.h"
38
 
 
39
 
#include "drizzled/visibility.h"
40
 
 
41
 
namespace drizzled
42
 
{
43
 
 
44
 
class Session;
45
 
 
46
 
namespace message { class Transaction; }
47
 
 
48
 
namespace plugin
49
 
{
50
 
 
51
 
/**
52
 
 * Base class for appliers of Transaction messages
53
 
 */
54
 
class DRIZZLED_API TransactionApplier : public Plugin
55
 
{
56
 
  TransactionApplier();
57
 
  TransactionApplier(const TransactionApplier &);
58
 
  TransactionApplier& operator=(const TransactionApplier &);
59
 
public:
60
 
  explicit TransactionApplier(std::string name_arg)
61
 
    : Plugin(name_arg, "TransactionApplier")
62
 
  {
63
 
  }
64
 
  virtual ~TransactionApplier() {}
65
 
  /**
66
 
   * Apply something to a target.
67
 
   *
68
 
   * @note
69
 
   *
70
 
   * It is important to note that memory allocation for the 
71
 
   * supplied pointer is not guaranteed after the completion 
72
 
   * of this function -- meaning the caller can dispose of the
73
 
   * supplied message.  Therefore, appliers which are
74
 
   * implementing an asynchronous replication system must copy
75
 
   * the supplied message to their own controlled memory storage
76
 
   * area.
77
 
   *
78
 
   * @param Transaction message to be replicated
79
 
   */
80
 
  virtual ReplicationReturnCode apply(Session &in_session,
81
 
                                      const message::Transaction &to_apply)= 0;
82
 
 
83
 
  static bool addPlugin(TransactionApplier *applier);
84
 
  static void removePlugin(TransactionApplier *applier);
85
 
};
86
 
 
87
 
} /* namespace plugin */
88
 
} /* namespace drizzled */
89
 
 
90
 
#endif /* DRIZZLED_PLUGIN_TRANSACTION_APPLIER_H */