GlobalObjects
Lade ...
Suche ...
Keine Treffer
GloTransactionManager.h
gehe zur Dokumentation dieser Datei
1#ifndef INC_GLOTRANSACTIONMANAGER_H
2#define INC_GLOTRANSACTIONMANAGER_H
3//-----------------------------------------------------------------------------
47//-----------------------------------------------------------------------------
48#include <list>
49#include <map>
50#include <unordered_map>
51#include <memory>
52
53#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__MINGW64__)
54 #include <basetsd.h>
55#elif defined(__GNUC__)
56 #define INT_PTR intptr_t
57#endif
58
59#include "GloTypes.h"
60#include "GloObjID.h"
61#include "GloTransactionOwner.h"
62//-----------------------------------------------------------------------------
63namespace glo
64{
65 //---------------------------------------------------------------------------
66 /* Forwards */
67 class Record;
68 class Communicator;
69 //---------------------------------------------------------------------------
70 #ifdef _MSC_VER
71 /* 'Bezeichner': Klasse 'Typ' benötigt eine DLL-Schnittstelle, die von... */
72 #pragma warning( disable : 4251 )
73 #endif
74 //---------------------------------------------------------------------------
75 // doxygen -> warning: unable to resolve reference to 'GLO_REF_DEPENDENT' for \ref command
76 // Is a reference to the GlobalObjects documentation.
77 //---------------------------------------------------------------------------
172 {
173 public:
174 //============== Enumeration
175 //-----------------------------------------------------------------------
186 {
187 eTRX_STORE,
196 eTRX_DELETE
205 };
206 //-----------------------------------------------------------------------
207
208 //-----------------------------------------------------------------------
209 // >>>>>>>>>>>>>>>>>>>>>> TransactionBase >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
210 //-----------------------------------------------------------------------
224 {
225 public:
226 //============= De- und Konstruktoren
227 //---------------------------------------------------------------------
238 //---------------------------------------------------------------------
249 //---------------------------------------------------------------------
250
251 private:
252 //---------------------------------------------------------------------
263 //---------------------------------------------------------------------
264
265 //============== Operatoren
266 //---------------------------------------------------------------------
277 //---------------------------------------------------------------------
278 };
279 //-----------------------------------------------------------------------
280 // <<<<<<<<<<<<<<<<<<<<<<<< TransactionBase <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
281 //-----------------------------------------------------------------------
282
283 //-----------------------------------------------------------------------
284 // >>>>>>>>>>>>>>>>>>>>>>> TransactionPoint >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
285 //-----------------------------------------------------------------------
299 {
300 private:
301 //============== Attribute
302 //---------------------------------------------------------------------
317 //---------------------------------------------------------------------
318
319 public:
320 //============= Konstruktoren
321 //---------------------------------------------------------------------
332 //---------------------------------------------------------------------
344 TransactionPoint( int iCount );
345 //---------------------------------------------------------------------
346
347 private:
348 //============= Konstruktor
349 //---------------------------------------------------------------------
360 //---------------------------------------------------------------------
361
362 public:
363 //============= Destruktor
364 //---------------------------------------------------------------------
375 //---------------------------------------------------------------------
376
377 //============== Methoden
378 //---------------------------------------------------------------------
390 int getCount() const;
391 //---------------------------------------------------------------------
392
393 private:
394 //============== Operatoren
395 //---------------------------------------------------------------------
406 //---------------------------------------------------------------------
407 };
408 //-----------------------------------------------------------------------
409 // <<<<<<<<<<<<<<<<<<<<< TransactionPoint <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
410 //-----------------------------------------------------------------------
411
412 //-----------------------------------------------------------------------
413 // >>>>>>>>>>>>>>>>>>>>> TransactionStep >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
414 //-----------------------------------------------------------------------
428 {
429 private:
430 //============== Attribute
431 //---------------------------------------------------------------------
445 //---------------------------------------------------------------------
456 //---------------------------------------------------------------------
468 //---------------------------------------------------------------------
469
470 protected:
471 //============== Konstruktoren
472 //---------------------------------------------------------------------
483 //---------------------------------------------------------------------
484
485 public:
486 //============== Konstruktoren
487 //---------------------------------------------------------------------
519 Record * pActionRecord,
520 bool bLocalCopy = false );
521 //---------------------------------------------------------------------
522
523 private:
524 //============= Konstruktor
525 //---------------------------------------------------------------------
536 //---------------------------------------------------------------------
537
538 public:
539 //============= Destruktor
540 //---------------------------------------------------------------------
551 //---------------------------------------------------------------------
552
553 //============== Methoden
554 //---------------------------------------------------------------------
571 void getActionRecord( Record *& prRetVal ) const;
572 //---------------------------------------------------------------------
592 const Record * getActionRecord() const;
593 //---------------------------------------------------------------------
607 //---------------------------------------------------------------------
621 //---------------------------------------------------------------------
634 //---------------------------------------------------------------------
658 int takeOverObjIDsFilePos( const Record & rSourceRecord );
659 //---------------------------------------------------------------------
660
661 private:
662 //============== Operatoren
663 //---------------------------------------------------------------------
674 //---------------------------------------------------------------------
675 };
676 //-----------------------------------------------------------------------
677 // <<<<<<<<<<<<<<<<<<<<<<< TransactionStep <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
678 //-----------------------------------------------------------------------
679
680 //-----------------------------------------------------------------------
681 // >>>>>>>>>>>>>>>> CommunicatorTransactionStack >>>>>>>>>>>>>>>>>>>>>>>>>>
682 //-----------------------------------------------------------------------
698 {
699 private:
700 //============== Attribute
701 //---------------------------------------------------------------------
712 //---------------------------------------------------------------------
724 std::list<TransactionBase *> m_TransactionStack;
725 //---------------------------------------------------------------------
736 //---------------------------------------------------------------------
737
738 protected:
739 //============= Konstruktor
740 //---------------------------------------------------------------------
751 //---------------------------------------------------------------------
752
753 public:
754 //============= De- und Konstruktoren
755 //---------------------------------------------------------------------
771 CommunicatorTransactionStack( const TransactionOwner & rCommunicatorWithTreadID );
772 //---------------------------------------------------------------------
784 //---------------------------------------------------------------------
785
786 private:
787 //============== Copy-Konstruktor
788 //---------------------------------------------------------------------
799 //---------------------------------------------------------------------
800
801 public:
802 //============== Methoden
803 //---------------------------------------------------------------------
817 //---------------------------------------------------------------------
830 //---------------------------------------------------------------------
846 //---------------------------------------------------------------------
878 bool abortTransaction( std::list< TransactionBase * > & rAbortedTransactionStepList );
879 //---------------------------------------------------------------------
905 int setTransactionStep( NUM_PTR & nNewTrxStepAddr,
906 EnStoreDelete eAction,
907 Record * pActionRecord );
908 //---------------------------------------------------------------------
920 std::list< TransactionManager::TransactionBase * > & getTransactionStack();
921 //---------------------------------------------------------------------
922
923 private:
924 //============== Operatoren
925 //---------------------------------------------------------------------
936 //---------------------------------------------------------------------
937 };
938 //-----------------------------------------------------------------------
939 // <<<<<<<<<<<<<<<<< CommunicatorTransactionStack <<<<<<<<<<<<<<<<<<<<<<<<<
940 //-----------------------------------------------------------------------
941
942 private:
943 //============== Attribute
944 //-----------------------------------------------------------------------
957 std::map< TransactionOwner, CommunicatorTransactionStack *, std::less<TransactionOwner> > m_TransactionStackMap;
958 //-----------------------------------------------------------------------
968 std::map< TransactionOwner, CommunicatorTransactionStack * >::iterator m_TransactionStackMapIterator;
969 //-----------------------------------------------------------------------
980 std::unordered_map< ObjID, Record *, glo::ObjID::HashFunction > m_RecursionRecordMap;
981 //-----------------------------------------------------------------------
982
983 public:
984 //============== De- und Konstruktor
985 //-----------------------------------------------------------------------
996 //-----------------------------------------------------------------------
1007 //-----------------------------------------------------------------------
1008
1009 private:
1010 //============== Copy-Konstruktor
1011 //-----------------------------------------------------------------------
1022 //-----------------------------------------------------------------------
1023
1024 public:
1025 //============== Methoden
1026 //-----------------------------------------------------------------------
1044 void beginTransaction( const TransactionOwner & rCommunicatorWithTreadID );
1045 //-----------------------------------------------------------------------
1077 const TransactionOwner & rCommunicatorWithTreadID );
1078 //-----------------------------------------------------------------------
1104 int abortTransaction( std::list< TransactionBase * > & rAbortedTransactionStepList,
1105 const TransactionOwner & rCommunicatorWithTreadID );
1106 //-----------------------------------------------------------------------
1135 int setTransactionStep( NUM_PTR & nNewTrxStepAddr,
1136 const TransactionOwner & rCommunicatorWithTreadID,
1137 EnStoreDelete eAction,
1138 Record * pActionRecord);
1139 //-----------------------------------------------------------------------
1182 int getActionRecord( Record *& prRetVal,
1183 EnStoreDelete & reAction,
1184 const TransactionOwner & rCommunicatorWithTreadID,
1185 const ObjID & rObjID,
1186 const std::string & rsDataPath,
1187 bool bInRecursion = false );
1188 //-----------------------------------------------------------------------
1220 int getActionRecord( std::shared_ptr < Record > & rRetVal,
1221 EnStoreDelete & reAction,
1222 const TransactionOwner & rCommunicatorWithTreadID,
1223 const ObjID & rObjID,
1224 const std::string & rsDataPath,
1225 bool bInRecursion = false );
1226 //-----------------------------------------------------------------------
1241 bool inTransaction( const TransactionOwner & rCommunicatorWithTreadID ) const;
1242 //-----------------------------------------------------------------------
1256 void deleteAllTransactions( Communicator * pCommunicator );
1257 //-----------------------------------------------------------------------
1258
1259 protected:
1260 //============== Methoden
1261 //-----------------------------------------------------------------------
1281 //-----------------------------------------------------------------------
1296 //-----------------------------------------------------------------------
1297
1298 private:
1299 //-----------------------------------------------------------------------
1310 //-----------------------------------------------------------------------
1311
1312 //============== Operatoren
1313 //-----------------------------------------------------------------------
1324 //-----------------------------------------------------------------------
1325 };
1326 //---------------------------------------------------------------------------
1327 #ifdef _MSC_VER
1328 /* 'Bezeichner': Klasse 'Typ' benötigt eine DLL-Schnittstelle, die von... */
1329 #pragma warning( default : 4251 )
1330 #endif
1331 //---------------------------------------------------------------------------
1332} // namespace glo
1333#endif
Header für ObjID
Header für TransactionOwner
Für jede Bibliothek, hier 'GlobalObjects' gibt es eine Typen-Datei.
#define __glo_export_dll
Definition GloTypes.h:70
OberKlasse von LocalThread, ClientThread und ServerThread, weil diese als Sender und Empfänger (Kommu...
Definition GloCommunicator.h:93
Ein Objekt-ID besteht aus der Klassen-ID, einer Datenbank-ID und der eigentlichen eindeutigen ObjektZ...
Definition GloObjID.h:84
Objekte dieser Klasse transportieren die Daten von den Tabellen ins persistente Objekt und von diesen...
Definition GloRecord.h:108
Der Transaktions-Stack eines Client-Kommunikators mit Thread-ID für eine Datenbank.
Definition GloTransactionManager.h:698
CommunicatorTransactionStack(const TransactionOwner &rCommunicatorWithTreadID)
int setTransactionStep(NUM_PTR &nNewTrxStepAddr, EnStoreDelete eAction, Record *pActionRecord)
TransactionOwner m_CommunicatorWithTreadID
Definition GloTransactionManager.h:711
CommunicatorTransactionStack(const CommunicatorTransactionStack &)
std::list< TransactionManager::TransactionBase * > & getTransactionStack()
std::list< TransactionBase * > m_TransactionStack
Definition GloTransactionManager.h:724
bool abortTransaction(std::list< TransactionBase * > &rAbortedTransactionStepList)
int m_iCurrentTransactionPoint
Definition GloTransactionManager.h:735
Basisklasse für TransactionPoint und TransactionStep.
Definition GloTransactionManager.h:224
TransactionBase(const TransactionBase &)
Objekte dieser Klasse spiegeln einen Transaktions-Start wieder.
Definition GloTransactionManager.h:299
TransactionPoint(const TransactionPoint &)
int m_iCount
Definition GloTransactionManager.h:316
Objekte dieser Klasse spiegeln eine Datensatz-Operation wieder.
Definition GloTransactionManager.h:428
TransactionStep(EnStoreDelete eAction, Record *pActionRecord, bool bLocalCopy=false)
TransactionManager::EnStoreDelete m_eAction
Definition GloTransactionManager.h:467
bool m_bLocalCopyRecord
Definition GloTransactionManager.h:444
TransactionStep(const TransactionStep &)
TransactionManager::EnStoreDelete getAction() const
int takeOverObjIDsFilePos(const Record &rSourceRecord)
void getActionRecord(Record *&prRetVal) const
Record * m_pActionRecord
Definition GloTransactionManager.h:455
const Record * getActionRecord() const
Klasse um Transaktionen zu gewährleisten.
Definition GloTransactionManager.h:172
std::map< TransactionOwner, CommunicatorTransactionStack * >::iterator m_TransactionStackMapIterator
Definition GloTransactionManager.h:968
EnStoreDelete
Definition GloTransactionManager.h:186
std::map< TransactionOwner, CommunicatorTransactionStack *, std::less< TransactionOwner > > m_TransactionStackMap
Definition GloTransactionManager.h:957
TransactionManager::CommunicatorTransactionStack * getTransactionStack(const TransactionOwner &rCommunicatorWithTreadID)
int getActionRecord(Record *&prRetVal, EnStoreDelete &reAction, const TransactionOwner &rCommunicatorWithTreadID, const ObjID &rObjID, const std::string &rsDataPath, bool bInRecursion=false)
void beginTransaction(const TransactionOwner &rCommunicatorWithTreadID)
int commitTransaction(CommunicatorTransactionStack *&prRetVal, const TransactionOwner &rCommunicatorWithTreadID)
int setTransactionStep(NUM_PTR &nNewTrxStepAddr, const TransactionOwner &rCommunicatorWithTreadID, EnStoreDelete eAction, Record *pActionRecord)
std::unordered_map< ObjID, Record *, glo::ObjID::HashFunction > m_RecursionRecordMap
Definition GloTransactionManager.h:980
void removeCurrentTransactionStack()
void deleteAllTransactions(Communicator *pCommunicator)
bool inTransaction(const TransactionOwner &rCommunicatorWithTreadID) const
int writeTransactionFile(CommunicatorTransactionStack *pTransactionStack)
int getActionRecord(std::shared_ptr< Record > &rRetVal, EnStoreDelete &reAction, const TransactionOwner &rCommunicatorWithTreadID, const ObjID &rObjID, const std::string &rsDataPath, bool bInRecursion=false)
int abortTransaction(std::list< TransactionBase * > &rAbortedTransactionStepList, const TransactionOwner &rCommunicatorWithTreadID)
TransactionManager(const TransactionManager &)
Um Transaktionen nicht nur einem glo::Communicator zur Verfügung zu stellen, sondern auch einzelnen T...
Definition GloTransactionOwner.h:81
Definition GloAbstractBaseLot.h:49