1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008-2009 Sun Microsystems, Inc.
5
* Copyright (C) 2010 Jay Pipes
9
* Jay Pipes <jaypipes@gmail.com>
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.
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.
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
25
#ifndef DRIZZLED_PLUGIN_TRANSACTION_APPLIER_H
26
#define DRIZZLED_PLUGIN_TRANSACTION_APPLIER_H
29
* @file Defines the API for a TransactionApplier
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()
36
#include "drizzled/plugin/plugin.h"
37
#include "drizzled/plugin/replication.h"
39
#include "drizzled/visibility.h"
46
namespace message { class Transaction; }
52
* Base class for appliers of Transaction messages
54
class DRIZZLED_API TransactionApplier : public Plugin
57
TransactionApplier(const TransactionApplier &);
58
TransactionApplier& operator=(const TransactionApplier &);
60
explicit TransactionApplier(std::string name_arg)
61
: Plugin(name_arg, "TransactionApplier")
64
virtual ~TransactionApplier() {}
66
* Apply something to a target.
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
78
* @param Transaction message to be replicated
80
virtual ReplicationReturnCode apply(Session &in_session,
81
const message::Transaction &to_apply)= 0;
83
static bool addPlugin(TransactionApplier *applier);
84
static void removePlugin(TransactionApplier *applier);
87
} /* namespace plugin */
88
} /* namespace drizzled */
90
#endif /* DRIZZLED_PLUGIN_TRANSACTION_APPLIER_H */