TransactionParams.cc

00001 /* 
00002    EyeDB Object Database Management System
00003    Copyright (C) 1994-2008 SYSRA
00004    
00005    EyeDB is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009    
00010    EyeDB 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 GNU
00013    Lesser General Public License for more details.
00014    
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with this library; if not, write to the Free Software
00017    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA 
00018 */
00019 
00020 /*
00021    Author: Eric Viara <viara@sysra.com>
00022 */
00023 
00024 
00025 #include <eyedb/eyedb.h>
00026 
00027 namespace eyedb {
00028 
00029   TransactionParams TransactionParams::global_def_params = 
00030   TransactionParams(TransactionOn, ReadNWriteSX, RecoveryFull,
00031                     0, 0, 30);
00032 
00033   TransactionParams::TransactionParams(TransactionMode trsmode,
00034                                        TransactionLockMode lockmode,
00035                                        RecoveryMode recovmode,
00036                                        unsigned int magorder,
00037                                        unsigned int ratioalrt,
00038                                        unsigned int wait_timeout)
00039   {
00040     this->trsmode = trsmode;
00041     this->lockmode = lockmode;
00042     this->recovmode = recovmode;
00043     this->magorder = magorder;
00044     this->ratioalrt = ratioalrt;
00045     this->wait_timeout = wait_timeout;
00046   }
00047 
00048   bool TransactionParams::operator==(const TransactionParams &params) const
00049   {
00050     return params.trsmode == trsmode &&
00051       params.lockmode == lockmode &&
00052       params.recovmode == recovmode &&
00053       params.magorder == magorder &&
00054       params.ratioalrt == ratioalrt &&
00055       params.wait_timeout == wait_timeout;
00056   }
00057 
00058   TransactionParams::TransactionParams()
00059   {
00060     *this = global_def_params;
00061   }
00062 
00063   Status TransactionParams::setGlobalDefaultTransactionParams
00064   (const TransactionParams &params)
00065   {
00066     Status s;
00067 
00068     if (s = Transaction::checkParams(params))
00069       return s;
00070 
00071     global_def_params = params;
00072     return Success;
00073   }
00074 
00075   TransactionParams TransactionParams::getGlobalDefaultTransactionParams()
00076   {
00077     return global_def_params;
00078   }
00079 
00080   void
00081   TransactionParams::setGlobalDefaultMagOrder(unsigned int magorder)
00082   {
00083     global_def_params.magorder = magorder;
00084   }
00085 
00086   unsigned int
00087   TransactionParams::getGlobalDefaultMagOrder()
00088   {
00089     return global_def_params.magorder;
00090   }
00091 }

Generated on Mon Dec 22 18:16:11 2008 for eyedb by  doxygen 1.5.3