GlobalObjects
Lade ...
Suche ...
Keine Treffer
GloLockManager.h
gehe zur Dokumentation dieser Datei
1#ifndef INC_GLOLOCKMANAGER_H
2#define INC_GLOLOCKMANAGER_H
3//-----------------------------------------------------------------------------
48//-----------------------------------------------------------------------------
49// TrxByThread
50//-----------------------------------------------------------------------------
51#include <list>
52#include <map>
53#include <unordered_map>
54#include <stack>
55#include "GloTypes.h"
56#include "GloManager.h"
57#include "GloObjID.h"
58#include "GloTransactionOwner.h"
59//-----------------------------------------------------------------------------
60namespace glo
61{
62 //---------------------------------------------------------------------------
63 /* Forwards */
64 class Communicator;
65 class Manager;
66 class Record;
67 //---------------------------------------------------------------------------
68 // doxygen -> warning: unable to resolve reference to 'GLO_REF_DEPENDENT' for \ref command
69 // Is a reference to the GlobalObjects documentation.
70 //---------------------------------------------------------------------------
200 // English
201 // |==========================================================================|
202 // | Obj1 | Obj2 |
203 // |--------------------------------------------------------------------------|
204 // |LOCK |Guarantee|Protection| Allowed LOCKs | Possibilities| Restrictions |
205 // |==========================================================================|
206 // | NN | none | none | all | all | none |
207 // | RD | R | D | RD, RW, WW, TW | R, W | D |
208 // | RW | R | D, W | RD, RW | R | D, W |
209 // | WW | R, W | D, W | RD | R | D, W |
210 // | DW | R, W, D | D, W | none | R | D, W |
211 // | DR | R, W, D | D, W, R | none | none | D, W, R |
212 // | EX | R, W, D | D, W, R | none | none | D, W, R |
213 // | TW | R, W | D, W | RD | R | D, W |
214 // | TD | R, W, D | D, W | none | R | D, W |
215 // |==========================================================================|
216
217 // German
218 // |==========================================================================|
219 // | Obj1 | Obj2 |
220 // |--------------------------------------------------------------------------|
221 // |LOCK | Garantie | Schutz | Elaubte LOCKs | Möglichkeiten | Restriktionen |
222 // |==========================================================================|
223 // | NN | keine | keine | alle | alle | keine |
224 // | RD | R | D | RD, RW, WW, TW | R, W | D |
225 // | RW | R | D, W | RD, RW | R | D, W |
226 // | WW | R, W | D, W | RD | R | D, W |
227 // | DW | R, W, D | D, W | keine | R | D, W |
228 // | DR | R, W, D | D, W, R | keine | keine | D, W, R |
229 // | EX | R, W, D | D, W, R | keine | keine | D, W, R |
230 // | TW | R, W | D, W | RD | R | D, W |
231 // | TD | R, W, D | D, W | keine | R | D, W |
232 // |==========================================================================|
233
234 #ifdef _GLO_TEST
235 class __glo_export_dll LockManager
236 #else
238 #endif
239 {
240 public:
241 //-----------------------------------------------------------------------
242 // >>>>>>>>>>>>>>>>> LockManager::LockedObject >>>>>>>>>>>>>>>>>>>>>>>>>>
243 //-----------------------------------------------------------------------
259 #ifdef _GLO_TEST
261 #else
263 #endif
264 {
265 private:
266 //============== Friends
267 //-------------------------------------------------------------------
268 friend class LockManager;
269 //-------------------------------------------------------------------
270
271 #ifdef _GLO_TEST
272 public:
273 #else
274 protected:
275 #endif
276 //-------------------------------------------------------------------
277 // >>>> LockManager::LockedObject::CommunicatorRightsRestrictions >>>
278 //-------------------------------------------------------------------
299 #ifdef _GLO_TEST
301 #else
303 #endif
304 {
305 private:
306 //============== Friends
307 //---------------------------------------------------------------
308 friend class LockManager;
309 friend class LockedObject;
310 //---------------------------------------------------------------
311
312 #ifdef _GLO_TEST
313 public:
314 #else
315 protected:
316 #endif
317 //============== Attribute
318 //---------------------------------------------------------------
329 //---------------------------------------------------------------
343 std::list< DependentObjsWithDeepMode * > m_READvDELETE_Count;
344 //---------------------------------------------------------------
358 std::list< DependentObjsWithDeepMode * > m_READvWRITE_Count;
359 //---------------------------------------------------------------
373 std::list< DependentObjsWithDeepMode * > m_WRITEvWRITE_Count;
374 //---------------------------------------------------------------
388 std::list< DependentObjsWithDeepMode * > m_DELETEvWRITE_Count;
389 //---------------------------------------------------------------
403 std::list< DependentObjsWithDeepMode * > m_DELETEvREAD_Count;
404 //---------------------------------------------------------------
418 std::list< DependentObjsWithDeepMode * > m_EXCLUSIVE_Count;
419 //---------------------------------------------------------------
433 std::list< DependentObjsWithDeepMode * > m_TRANSACTION_WRITE_Count;
434 //---------------------------------------------------------------
448 std::list< DependentObjsWithDeepMode * > m_TRANSACTION_DELETE_Count;
449 //---------------------------------------------------------------
450
451 public:
452 //============= Konstruktor
453 //---------------------------------------------------------------
464 //---------------------------------------------------------------
476 CommunicatorRightsRestrictions( const TransactionOwner & rCommunicatorWithTreadID );
477 //---------------------------------------------------------------
488 //---------------------------------------------------------------
489
490 //============== Methoden
491 //---------------------------------------------------------------
507 bool isNULL() const;
508 //---------------------------------------------------------------
527 //---------------------------------------------------------------
546 //---------------------------------------------------------------
565 //---------------------------------------------------------------
584 //---------------------------------------------------------------
603 //---------------------------------------------------------------
621 //---------------------------------------------------------------
640 //---------------------------------------------------------------
659 //---------------------------------------------------------------
675 bool hasReadProtection() const;
676 //---------------------------------------------------------------
692 bool hasWriteProtection() const;
693 //---------------------------------------------------------------
710 //---------------------------------------------------------------
725 bool hasReadGuarantee() const;
726 //---------------------------------------------------------------
741 bool hasWriteGuarantee() const;
742 //---------------------------------------------------------------
757 bool hasDeleteGuarantee() const;
758 //---------------------------------------------------------------
759
760 private:
761 //---------------------------------------------------------------
775 void deleteObjectsInList( std::list< DependentObjsWithDeepMode * > * pList );
776 //---------------------------------------------------------------
777 };
778 //-------------------------------------------------------------------
779 // <<<< LockManager::LockedObject::CommunicatorRightsRestrictions <<<
780 //-------------------------------------------------------------------
781
782 #ifdef _GLO_TEST
783 public:
784 #else
785 protected:
786 #endif
787 //============== Attribute
788 //-------------------------------------------------------------------
799 //-------------------------------------------------------------------
814 std::map< TransactionOwner, CommunicatorRightsRestrictions *, std::less<TransactionOwner> > m_CommunicatorMap;
815 //-------------------------------------------------------------------
816
817 //============= Konstruktor
818 //-------------------------------------------------------------------
829 //-------------------------------------------------------------------
830
831 public:
832 //============= Konstruktor
833 //-------------------------------------------------------------------
845 LockedObject (const ObjID & rLockObjekt);
846 //-------------------------------------------------------------------
857 //-------------------------------------------------------------------
858
859 private:
860 //============= Konstruktor
861 //-------------------------------------------------------------------
872 //-------------------------------------------------------------------
873
874 public:
875 //============== Methoden
876 //-------------------------------------------------------------------
888 ObjID getObjID () const;
889 //-------------------------------------------------------------------
917 int lockObject( const TransactionOwner & rCommunicatorWithTreadID,
918 std::stack< ObjID > * pDependObjIdStack,
919 EnLockMode eLockMode,
920 EnDeepMode eDeepMode,
921 bool bSimulate = false );
922 //-------------------------------------------------------------------
953 int unlockObject( const TransactionOwner & rCommunicatorWithTreadID,
954 std::stack< ObjID > *& prDependObjIdStack,
955 EnLockMode eLockMode,
956 EnDeepMode eDeepMode,
957 bool bSimulate = false );
958 //-------------------------------------------------------------------
982 bool hasAnyOtherCompetingProtection( const TransactionOwner & rCommunicatorWithTreadID,
983 EnLockMode eLockMode ) const;
984 //-------------------------------------------------------------------
1007 bool isPossible( const TransactionOwner & rCommunicatorWithTreadID,
1008 bool bRead,
1009 bool bWrite,
1010 bool bDelete) const;
1011 //-------------------------------------------------------------------
1025 std::size_t getNumCommunicators();
1026 //-------------------------------------------------------------------
1038 void deleteCommunicator( Communicator * pCommunicator );
1039 //-------------------------------------------------------------------
1040
1041 private:
1042 //============== Methoden
1043 //-------------------------------------------------------------------
1078 EnLockMode eLockMode,
1079 EnDeepMode eDeepMode,
1080 std::stack< ObjID > *& prUnlockDependObjIdStack,
1081 std::stack< ObjID > * pLockDependObjIdStack,
1082 bool bSimulate = false);
1083 //-------------------------------------------------------------------
1113 int setLockCount( std::list< DependentObjsWithDeepMode * > & rLockCountList,
1114 std::stack< ObjID > *& prUnlockDependObjIdStack,
1115 std::stack< ObjID > * pLockDependObjIdStack,
1116 EnDeepMode eDeepMode,
1117 bool bSimulate = false );
1118 //-------------------------------------------------------------------
1119
1120 private:
1121 //============== Operatoren
1122 //-------------------------------------------------------------------
1133 //-------------------------------------------------------------------
1134 };
1135 //-----------------------------------------------------------------------
1136 // <<<<<<<<<<<<<<<<< LockManager::LockedObject <<<<<<<<<<<<<<<<<<<<<<<<<<
1137 //-----------------------------------------------------------------------
1138
1139 private:
1140 //============== Attribute
1141 //-----------------------------------------------------------------------
1151 std::unordered_map< unsigned long, LockedObject * > m_LockedObjectMap;
1152 //-----------------------------------------------------------------------
1163 //-----------------------------------------------------------------------
1164
1165 protected:
1166 //============= Konstruktoren
1167 //-----------------------------------------------------------------------
1178 //-----------------------------------------------------------------------
1179
1180 public:
1181 //============== De- und Konstruktor
1182 //-----------------------------------------------------------------------
1197 LockManager( Manager * pDBManager );
1198 //-----------------------------------------------------------------------
1208 virtual ~LockManager();
1209 //-----------------------------------------------------------------------
1210
1211 private:
1212 //============== Konstruktoren
1213 //-----------------------------------------------------------------------
1224 //-----------------------------------------------------------------------
1225
1226 public:
1227 //============== Method
1228 //-----------------------------------------------------------------------
1256 int lockObject( const ObjID & rObjID,
1257 std::map< ObjID, Record *, std::less<ObjID> > & rDependObjects,
1258 const TransactionOwner & rCommunicatorWithTreadID,
1259 const std::string & rsSchemaName,
1260 EnLockMode eLockMode,
1261 EnDeepMode eDeepMode,
1262 bool bSimulate = false );
1263 //-----------------------------------------------------------------------
1290 int unlockObject( const ObjID & rObjID,
1291 const TransactionOwner & rCommunicatorWithTreadID,
1292 const std::string & rsSchemaName,
1293 EnLockMode eLockMode,
1294 EnDeepMode eDeepMode,
1295 bool bSimulate = false );
1296 //-----------------------------------------------------------------------
1323 bool isPossible( const ObjID & rObjID,
1324 std::map< ObjID, Record *, std::less<ObjID> > & rDependObjects,
1325 const TransactionOwner & rCommunicatorWithTreadID,
1326 bool bRead,
1327 bool bWrite,
1328 bool bDelete );
1329 //-----------------------------------------------------------------------
1348 std::map< ObjID, Record *, std::less<ObjID> > & rDependObjects,
1349 const TransactionOwner & rCommunicatorWithTreadID );
1350 //-----------------------------------------------------------------------
1365 void getNotAllowedReadObjects( std::list< ObjID > & rReadLockObjList,
1366 const TransactionOwner & rCommunicatorWithTreadID ) const;
1367 //-----------------------------------------------------------------------
1368 #ifdef _GLO_TEST
1384 std::unordered_map< unsigned long, LockedObject * > & getLockedObjects();
1385 #endif
1386 //-----------------------------------------------------------------------
1400 void deleteAllLocks( Communicator * pCommunicator, const std::string & rsSchemaName );
1401 //-----------------------------------------------------------------------
1402
1403 private:
1404 //============== Method
1405 //-----------------------------------------------------------------------
1423 void sendNotify( TdWatchNotifyMode nWatchNotifyMode,
1424 const ObjID & rObjID,
1425 Communicator * pCommunicator,
1426 const std::string & rsSchemaName );
1427 //-----------------------------------------------------------------------
1428
1429 private:
1430 //============== Operatoren
1431 //-----------------------------------------------------------------------
1441 LockManager & operator= ( const LockManager & );
1442 //-----------------------------------------------------------------------
1443 };
1444 //---------------------------------------------------------------------------
1445} // namespace glo
1446#endif
Header für Manager Manager::Receiver Manager::ObjIdWithDepends Manager::SchemaMapItem
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
Die einzelnen Sperrmodi des Objekts mit Objekt-ID aus LockedObject::m_LockObjektID für einen Kommunik...
Definition GloLockManager.h:304
std::list< DependentObjsWithDeepMode * > m_READvDELETE_Count
Definition GloLockManager.h:343
std::list< DependentObjsWithDeepMode * > m_TRANSACTION_WRITE_Count
Definition GloLockManager.h:433
std::list< DependentObjsWithDeepMode * > m_TRANSACTION_DELETE_Count
Definition GloLockManager.h:448
std::list< DependentObjsWithDeepMode * > m_EXCLUSIVE_Count
Definition GloLockManager.h:418
std::list< DependentObjsWithDeepMode * > m_READvWRITE_Count
Definition GloLockManager.h:358
void deleteObjectsInList(std::list< DependentObjsWithDeepMode * > *pList)
TransactionOwner m_CommunicatorWithTreadID
Definition GloLockManager.h:328
CommunicatorRightsRestrictions(const TransactionOwner &rCommunicatorWithTreadID)
std::list< DependentObjsWithDeepMode * > m_DELETEvWRITE_Count
Definition GloLockManager.h:388
std::list< DependentObjsWithDeepMode * > m_WRITEvWRITE_Count
Definition GloLockManager.h:373
std::list< DependentObjsWithDeepMode * > m_DELETEvREAD_Count
Definition GloLockManager.h:403
Objekte können gesperrt werden. Objekte dieser Klasse repräsentiert ein vom Kommunikatoren gesperrtes...
Definition GloLockManager.h:264
LockedObject(const ObjID &rLockObjekt)
ObjID m_LockObjektID
Definition GloLockManager.h:798
int setLocks(CommunicatorRightsRestrictions *pItem, EnLockMode eLockMode, EnDeepMode eDeepMode, std::stack< ObjID > *&prUnlockDependObjIdStack, std::stack< ObjID > *pLockDependObjIdStack, bool bSimulate=false)
bool isPossible(const TransactionOwner &rCommunicatorWithTreadID, bool bRead, bool bWrite, bool bDelete) const
int lockObject(const TransactionOwner &rCommunicatorWithTreadID, std::stack< ObjID > *pDependObjIdStack, EnLockMode eLockMode, EnDeepMode eDeepMode, bool bSimulate=false)
void deleteCommunicator(Communicator *pCommunicator)
bool hasAnyOtherCompetingProtection(const TransactionOwner &rCommunicatorWithTreadID, EnLockMode eLockMode) const
LockedObject(const LockedObject &)
int unlockObject(const TransactionOwner &rCommunicatorWithTreadID, std::stack< ObjID > *&prDependObjIdStack, EnLockMode eLockMode, EnDeepMode eDeepMode, bool bSimulate=false)
int setLockCount(std::list< DependentObjsWithDeepMode * > &rLockCountList, std::stack< ObjID > *&prUnlockDependObjIdStack, std::stack< ObjID > *pLockDependObjIdStack, EnDeepMode eDeepMode, bool bSimulate=false)
std::map< TransactionOwner, CommunicatorRightsRestrictions *, std::less< TransactionOwner > > m_CommunicatorMap
Definition GloLockManager.h:814
Objekte dieser Klasse überwachen den Sperrzustand von Objekten.
Definition GloLockManager.h:239
LockPossibleSpecification getProcessingPossibilities(const ObjID &rObjID, std::map< ObjID, Record *, std::less< ObjID > > &rDependObjects, const TransactionOwner &rCommunicatorWithTreadID)
Manager * m_pDBManager
Definition GloLockManager.h:1162
LockManager(Manager *pDBManager)
virtual ~LockManager()
LockManager(const LockManager &)
void sendNotify(TdWatchNotifyMode nWatchNotifyMode, const ObjID &rObjID, Communicator *pCommunicator, const std::string &rsSchemaName)
int unlockObject(const ObjID &rObjID, const TransactionOwner &rCommunicatorWithTreadID, const std::string &rsSchemaName, EnLockMode eLockMode, EnDeepMode eDeepMode, bool bSimulate=false)
void getNotAllowedReadObjects(std::list< ObjID > &rReadLockObjList, const TransactionOwner &rCommunicatorWithTreadID) const
bool isPossible(const ObjID &rObjID, std::map< ObjID, Record *, std::less< ObjID > > &rDependObjects, const TransactionOwner &rCommunicatorWithTreadID, bool bRead, bool bWrite, bool bDelete)
int lockObject(const ObjID &rObjID, std::map< ObjID, Record *, std::less< ObjID > > &rDependObjects, const TransactionOwner &rCommunicatorWithTreadID, const std::string &rsSchemaName, EnLockMode eLockMode, EnDeepMode eDeepMode, bool bSimulate=false)
void deleteAllLocks(Communicator *pCommunicator, const std::string &rsSchemaName)
std::unordered_map< unsigned long, LockedObject * > m_LockedObjectMap
Definition GloLockManager.h:1151
Das Objekt dieser Klasse ist die zentrale Anlaufstelle für Aktionen, welche mit GlobalObjects-Daten z...
Definition GloManager.h:193
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
Um Transaktionen nicht nur einem glo::Communicator zur Verfügung zu stellen, sondern auch einzelnen T...
Definition GloTransactionOwner.h:81
Definition GloAbstractBaseLot.h:49
EnDeepMode
Definition GloTypes.h:254
EnLockMode
Definition GloTypes.h:1055
unsigned long TdWatchNotifyMode
Definition GloTypes.h:558
Es können erlaubte Aktionen in der Datenbank wie lesen, schreiben und löschen für ein Objekt erfragt ...
Definition GloTypes.h:1256