Drizzled Public API Documentation

transaction_ms.h

00001 /* Copyright (C) 2009 PrimeBase Technologies GmbH, Germany
00002  *
00003  * PrimeBase Media Stream for MySQL
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00018  *
00019  * Barry Leslie
00020  *
00021  * 2009-07-09
00022  *
00023  * H&G2JCtL
00024  *
00025  * PBMS transaction daemon.
00026  *
00027  *
00028  */
00029  
00030 #pragma once
00031 #ifndef __TRANSACTION_MS_H__
00032 #define __TRANSACTION_MS_H__
00033 #include "cslib/CSDefs.h"
00034 
00035 class MSTrans;
00036 class MSTransactionThread;
00037 
00038 class MSTransactionManager {
00039 public:
00040   MSTransactionManager(){}
00041   
00042   static void startUp();
00043   static void shutDown();
00044   static void flush();
00045   static void suspend(bool do_flush = false);
00046   static void resume();
00047   static void commit();
00048   static void rollback();
00049   static void rollbackToPosition(uint32_t position);
00050   
00051 #ifdef DRIZZLED
00052   static void setSavepoint(const char *savePoint);
00053   static void releaseSavepoint(const char *savePoint);
00054   static void rollbackTo(const char *savePoint);
00055 #endif
00056 
00057   static void referenceBLOB(uint32_t db_id, uint32_t tab_id, uint64_t blob_id, uint64_t blob_ref_id)
00058    {
00059     logTransaction(true, db_id, tab_id, blob_id, blob_ref_id);
00060    }
00061   static void dereferenceBLOB(uint32_t db_id, uint32_t tab_id, uint64_t blob_id, uint64_t blob_ref_id)
00062    {
00063     logTransaction(false, db_id, tab_id, blob_id, blob_ref_id);
00064    }
00065   
00066   static void dropDatabase(uint32_t db_id);
00067 private:
00068   static void startUpReader();
00069   static void logTransaction(bool ref, uint32_t db_id, uint32_t tab_id, uint64_t blob_id, uint64_t blob_ref_id);
00070   static MSTransactionThread *tm_Reader;
00071   
00072   friend class  MSTempLogThread;
00073   static MSTrans *tm_Log;
00074   
00075 };
00076 
00077 #endif