Drizzled Public API Documentation

transaction_replicator.h

00001 /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002  *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
00003  *
00004  *  Copyright (C) 2008-2009 Sun Microsystems, Inc.
00005  *  Copyright (C) 2010 Jay Pipes
00006  *
00007  *  Authors:
00008  *
00009  *    Jay Pipes <jaypipes@gmail.com>
00010  *
00011  *  This program is free software; you can redistribute it and/or modify
00012  *  it under the terms of the GNU General Public License as published by
00013  *  the Free Software Foundation; version 2 of the License.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU General Public License for more details.
00019  *
00020  *  You should have received a copy of the GNU General Public License
00021  *  along with this program; if not, write to the Free Software
00022  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00023  */
00024 
00025 #pragma once
00026 
00027 #include <drizzled/plugin/replication.h>
00028 #include <drizzled/plugin/plugin.h>
00029 
00030 #include <drizzled/visibility.h>
00031 
00041 namespace drizzled
00042 {
00043 namespace message
00044 { 
00045   class Transaction;
00046   class Statement;
00047 }
00048 
00049 class Session;
00050 
00051 namespace plugin
00052 {
00053 
00054 class TransactionApplier;
00055 
00059 class DRIZZLED_API TransactionReplicator : public Plugin
00060 {
00061   TransactionReplicator();
00062   TransactionReplicator(const TransactionReplicator &);
00063   TransactionReplicator& operator=(const TransactionReplicator &);
00064 public:
00065   explicit TransactionReplicator(std::string name_arg)
00066     : Plugin(name_arg, "TransactionReplicator")
00067   {
00068   }
00069   virtual ~TransactionReplicator() {}
00070 
00087   virtual ReplicationReturnCode replicate(TransactionApplier *in_applier, 
00088                                           Session &session,
00089                                           message::Transaction &to_replicate)= 0;
00090   static bool addPlugin(TransactionReplicator *replicator);
00091   static void removePlugin(TransactionReplicator *replicator);
00092 };
00093 
00094 } /* namespace plugin */
00095 } /* namespace drizzled */
00096