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 <jaypipes@gmail.com> 00006 * 00007 * Authors: 00008 * 00009 * Jay Pipes <jaypipes@gmail.com.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; either version 2 of the License, or 00014 * (at your option) any later version. 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU General Public License 00022 * along with this program; if not, write to the Free Software 00023 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00024 */ 00025 00035 #pragma once 00036 00037 #include <drizzled/replication_services.h> 00038 #include <drizzled/plugin/transaction_applier.h> 00039 00040 #include "transaction_log_entry.h" 00041 00042 #include <vector> 00043 #include <string> 00044 00045 namespace drizzled 00046 { 00047 class Session; 00048 } 00049 00050 class TransactionLog; 00051 class TransactionLogIndex; 00052 class WriteBuffer; 00053 00054 class TransactionLogApplier: public drizzled::plugin::TransactionApplier 00055 { 00056 public: 00057 TransactionLogApplier(const std::string name_arg, 00058 TransactionLog *in_transaction_log, 00059 TransactionLogIndex *in_transaction_log_index, 00060 uint32_t in_num_write_buffers); 00061 00063 ~TransactionLogApplier(); 00064 00081 drizzled::plugin::ReplicationReturnCode 00082 apply(drizzled::Session &in_session, 00083 const drizzled::message::Transaction &to_apply); 00084 private: 00085 /* Don't allows these */ 00086 TransactionLogApplier(); 00087 TransactionLogApplier(const TransactionLogApplier &other); 00088 TransactionLogApplier &operator=(const TransactionLogApplier &other); 00093 TransactionLog *transaction_log; 00094 TransactionLogIndex *transaction_log_index; 00095 uint32_t num_write_buffers; 00096 std::vector<WriteBuffer *> write_buffers; 00097 00103 WriteBuffer *getWriteBuffer(const drizzled::Session &session); 00104 }; 00105