Drizzled Public API Documentation

xa_storage_engine.cc
00001 /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002  *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
00003  *
00004  *  Copyright (C) 2008 Sun Microsystems, Inc.
00005  *  Copyright (C) 2010 Jay Pipes <jaypipes@gmail.com>
00006  *
00007  *  This program is free software; you can redistribute it and/or modify
00008  *  it under the terms of the GNU General Public License as published by
00009  *  the Free Software Foundation; version 2 of the License.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00019  */
00020 
00021 #include <config.h>
00022 
00023 #include <drizzled/cached_directory.h>
00024 
00025 #include <drizzled/definitions.h>
00026 #include <drizzled/session.h>
00027 #include <drizzled/error.h>
00028 #include <drizzled/gettext.h>
00029 #include <drizzled/plugin/xa_storage_engine.h>
00030 #include <drizzled/xid.h>
00031 
00032 #include <string>
00033 #include <vector>
00034 #include <algorithm>
00035 #include <functional>
00036 
00037 namespace drizzled
00038 {
00039 
00040 namespace plugin
00041 {
00042 
00043 static std::vector<XaStorageEngine *> vector_of_xa_engines;
00044 
00045 XaStorageEngine::XaStorageEngine(const std::string name_arg,
00046                                  const std::bitset<HTON_BIT_SIZE> &flags_arg) :
00047   TransactionalStorageEngine(name_arg, flags_arg)
00048 {}
00049 
00050 XaStorageEngine::~XaStorageEngine()
00051 {}
00052 
00053 bool XaStorageEngine::addPlugin(XaStorageEngine *engine)
00054 {
00055   vector_of_xa_engines.push_back(engine);
00056 
00057   return TransactionalStorageEngine::addPlugin(engine) &&
00058          XaResourceManager::addPlugin(engine);
00059 }
00060 
00061 void XaStorageEngine::removePlugin(XaStorageEngine *engine)
00062 {
00063   vector_of_xa_engines.clear();
00064   TransactionalStorageEngine::removePlugin(engine);
00065   XaResourceManager::removePlugin(engine);
00066 }
00067 
00068 } /* namespace plugin */
00069 } /* namespace drizzled */