GlobalObjects
|
Classes to monitor persistent objects and to notify the respective clients of changes. More...
#include <GloWatchNotifyManager.h>
Classes | |
class | ClassWatch |
Monitoring class for AllSets. More... | |
class | ClientWatch |
Monitoring class for client logins and logouts. More... | |
class | CommunicatorCallBackClassIndex |
Is a unique index for maps of CommunicatorClassNotifyModes and as index for the static action lists. More... | |
class | CommunicatorCallBackClientIndex |
Is a unique index for maps of CommunicatorClientNotifyModes and as index for the static action lists. More... | |
class | CommunicatorCallBackIndex |
Base class of a unique index for maps of derived classes of CommunicatorNotifyModes and as index for the static action lists. More... | |
class | CommunicatorCallBackIndexReadWriteIndex |
Is a unique index for maps from CommunicatorCallBackIndexReadWriteIndex and as index for the static action lists. More... | |
class | CommunicatorCallBackObjIndex |
Is a unique index for maps of CommunicatorObjNotifyModes and as index for the static action lists. More... | |
class | CommunicatorClassNotifyModes |
Monitoring or notification mode of AllSets. More... | |
class | CommunicatorClientNotifyModes |
Monitoring or notification mode of client logins and logouts. More... | |
class | CommunicatorIndexReadWriteNotifyModes |
Monitoring or notification mode for read index, write index and reindex actions of the database More... | |
class | CommunicatorNotifyModes |
Basic class of the individual monitoring or notification modes. More... | |
class | CommunicatorObjNotifyModes |
Monitoring or notification mode of objects with their dependent objects. Dependent objects are the embedded or directly loaded objects in pointers and pointer lists. More... | |
class | IndexReadWriteWatch |
Monitoring class for read-index, write-index and reindex actions of the database. More... | |
class | NotifyClientInfo |
Is used for notifying information about clients in a job to the WatchNotifyManager. More... | |
class | NotifyIndexReadWriteInfo |
Is used for Notify-Infos to monitor the reading, writing and reindexing of the indexes in an order to the WatchNotifyManager. More... | |
class | NotifyInfo |
Base class for different Notify-Infos, which are used in a order to the WatchNotifyManager. More... | |
class | NotifyObjInfo |
Is used for notifying information about objects in an order to the WatchNotifyManager. More... | |
class | ObjectWatch |
Monitoring class for objects. More... | |
Public Member Functions | |
WatchNotifyManager (Manager *pMyDBManager) | |
virtual | ~WatchNotifyManager () |
virtual void | cancel () override |
void | deleteCommunicatorWatches (Communicator *pCommunicator) |
bool | hasObjectWatching (TdWatchNotifyMode tdWatchNotifyMode) const |
void | takeOrder (OrderMsg *pOrderMsg) |
Public Member Functions inherited from eut::RepeatingThread | |
RepeatingThread () | |
virtual | ~RepeatingThread () |
virtual void | finishBreak () |
int | getBreakCounter () |
bool | isInExclusiveAccess () const |
void | setExclusiveAccess () |
void | signalInput () |
virtual int | start () |
RepeatingThread::STATUS | status () const |
virtual void | takeABreak () |
bool | testCancel () |
void | unsetExclusiveAccess () |
void | waitForInput () |
Protected Member Functions | |
WatchNotifyManager () | |
void | deleteAllAction (Communicator *pCommunicator, std::list< CommunicatorCallBackIndex * > &rActionList) |
void | deleteCommunicatorWatches (OrderMsg *pOrderMsg) |
bool | getClassWatch (ClassWatch *&prClassWatch, unsigned long ulClassID, bool bAlsoGenerate) |
void | processNotify (OrderMsg *pOrderMsg) const |
void | processNotify (OrderMsg *pOrderMsg, std::list< CommunicatorCallBackIndex * > &rActionList) const |
int | processObjectSetWatch (Communicator *pCommunicator, const WatchSpecification &rWatchSpecification, std::list< Manager::ObjIdWithDepends * > &rInputList) |
int | processObjectUnsetWatch (Communicator *pCommunicator, const WatchSpecification &rWatchSpecification, std::list< ObjID > &rInputList) |
int | processWatch (const std::string &rsSchemaName, Communicator *pCommunicator, OrderMsg::EnOrderType eOrderType, void *pOrderObject, void *pAdditionalInfo) |
void | processWatch (OrderMsg *pOrderMsg) |
void | removeClassWatch (unsigned long ulClassID) |
int | setInternWatch (Communicator *pCommunicator, NUM_PTR ipCallBack, const ObjID &rObjID, std::map< ObjID, Record *, std::less< ObjID > > &rDependObjectsMap, TdWatchNotifyMode tdWatchNotifyMode, EnDeepMode eDeepMode) |
int | setInternWatch (Communicator *pCommunicator, NUM_PTR ipCallBack, TdWatchNotifyMode tdWatchNotifyMode) |
int | setInternWatch (Communicator *pCommunicator, NUM_PTR ipCallBack, unsigned long ulClassID, TdWatchNotifyMode tdWatchNotifyMode) |
int | unsetInternWatch (Communicator *pCommunicator, NUM_PTR ipCallBack, const ObjID &rObjID, TdWatchNotifyMode tdWatchNotifyMode, EnDeepMode eDeepMode, bool bSimulate=false) |
int | unsetInternWatch (Communicator *pCommunicator, NUM_PTR ipCallBack, TdWatchNotifyMode tdWatchNotifyMode, bool bSimulate=false) |
int | unsetInternWatch (Communicator *pCommunicator, NUM_PTR ipCallBack, unsigned long ulClassID, TdWatchNotifyMode tdWatchNotifyMode, bool bSimulate=false) |
int | unsetWatchDependObjects (Communicator *pCommunicator, NUM_PTR ipCallBack, std::stack< ObjID > &rDependObjIdStack, TdWatchNotifyMode tdWatchNotifyMode, bool bSimulate) |
virtual void | work () override |
Protected Member Functions inherited from eut::RepeatingThread | |
ORDER | getOrder () |
STATUS | getStatus () |
void | setStatus (STATUS eStatus) |
void | threadWork () |
void | toOrder (ORDER eOrder) |
Static Protected Member Functions | |
static void | insertAction (CommunicatorCallBackIndex *pCommunicatorCallBackIndex, std::list< CommunicatorCallBackIndex * > &rActionList) |
static void | removeAction (CommunicatorCallBackIndex *pCommunicatorCallBackIndex, std::list< CommunicatorCallBackIndex * > &rActionList) |
Private Member Functions | |
WatchNotifyManager (const WatchNotifyManager &) | |
WatchNotifyManager & | operator= (const WatchNotifyManager &) |
Private Attributes | |
std::unordered_map< unsigned long, ClassWatch * > | m_ClassWatchMap |
ClientWatch | m_ClientWatch |
eut::CriticalSection | m_ExclusiveProcessingSection |
IndexReadWriteWatch | m_IndexReadWriteWatch |
std::queue< OrderMsg * > | m_MsgQueue |
Manager * | m_pMyDBManager |
int | m_iWNM_WRITE |
To increase performance, the individual monitorings are counted. | |
int | m_iWNM_DELETE |
To increase performance, the individual monitorings are counted. | |
int | m_iWNM_LOCK |
To increase performance, the individual monitorings are counted. | |
int | m_iWNM_UNLOCK |
To increase performance, the individual monitorings are counted. | |
int | m_iWNM_INSERT |
To increase performance, the individual monitorings are counted. | |
Additional Inherited Members | |
Public Types inherited from eut::RepeatingThread | |
enum | EuTHREADERROR { EuTHREAD_ERR_NO_THREAD = -10301 , EuTHREAD_ERR_THREAD_ALREADY_WORKING = -10302 , EuTHREAD_ERR_THREAD_BREAK_COUNT_LESS_THAN_ZERO = -10303 , EuTHREAD_ERR_UNKNOWN = -10400 } |
Error range = -10301 to -10400 More... | |
enum | ORDER { eUNDEFINED , eDO_WORK , eEXIT } |
enum | STATUS { eAT_THE_START , eWORKING , ePAUSING , eENDING , eCOMPLETED } |
Public Attributes inherited from eut::RepeatingThread | |
std::string | m_strDebugInfo |
Classes to monitor persistent objects and to notify the respective clients of changes.
You can register Objects, ObjectSets and AllSets for monitoring.
You can monitor the 'Write', 'Delete', 'Lock', 'Release' and for AllSets the 'Insert' of an object.
You can monitor the logon and logoff of a Client to a database or GloServer.
You can monitor the progress of reading or writing and the reindexing of the Indexes as well as the progress of compressing a database.
- AllSet
For each object to be monitored (Object ID) or AllSet (Class ID) a ClassWatch, which itself has a notification list of CommunicatorClassNotifyModes, is instantiated and inserted into the m_ClassWatchMap.
- Object
If a Object is to be observed, an ObjectWatch, which itself has a notification list of CommunicatorObjectNotifyModes, is additionally instantiated and inserted into the ClassWatch::m_ObjectWatchMap.
- Client
If the logon or logoff of a Client to a GloServer or to a database is to be monitored, a ClientWatch, which itself has a notification list of CommunicatorClientNotifyModes, is instantiated and inserted into m_ClientWatch.
- Index
If the progress of reading or writing the Indexes is to be monitored, an IndexReadWriteWatch, which itself has a notification list of CommunicatorIndexReadWriteNotifyModes, is instantiated and inserted into m_IndexReadWriteWatch.
- Compress
If the progress of compressing a database is to be monitored, an IndexReadWriteWatch, which itself has a notification list of CommunicatorIndexReadWriteNotifyModes, is instantiated and added to m_IndexReadWriteWatch.
- CommunicatorClassNotifyModes
Objects of the class CommunicatorClassNotifyModes are unique by means of a reference to Communicator and an index (which can be used to notify the Communicator several times in an index-specific manner).
CommunicatorClassNotifyModes have a counter for each watch notify mode, which can be incremented or decremented (this means that each communicator is notified only once for each index).
- CommunicatorObjNotifyModes
CommunicatorObjNotifyModes are structured slightly differently. Since an object can be monitored with its dependent objects, for example, objects are passed with their dependent objects for monitoring.
For each monitoring mode there is a WatchModeList, in which the list of dependent objects with the monitoring depth is stored. If an object with a particular monitoring mode and monitoring depth is no longer to be monitored, the list is removed from the WatchModeList and any objects with the same monitoring mode are no longer monitored.
This is necessary because, for example, an object 'A' is monitored with a referenced object 'B'. The application can now dereference the referenced object 'B' in object 'A'. If the observation of object 'A' is removed, the previously referenced object 'B' is no longer linked in Basis and would otherwise no longer be released.
If all watch modes are set to 0, theCommunicatorNotifyModes object is removed from the respective list and deleted.
- CommunicatorClientNotifyModes
- CommunicatorIndexReadWriteNotifyModes
Objects of the classes CommunicatorClientNotifyModes and CommunicatorIndexReadWriteNotifyModes are unique by reference to Communicator.
Example 1: For example, if an AllSet is to be monitored, the ClassWatch with the same ClassID is searched for in the m_ClassWatchMap. If no corresponding ClassWatch exists, one is created and placed in the m_ClassWatchMap.
Example 2: If, for example, an object is to be monitored, the ClassWatch with the same ClassID is searched for in the m_ClassWatchMap. If no corresponding ClassWatch exists, one will be created and placed in the m_ClassWatchMap.
If a ClassWatch exists or is created, a CommunicatorNotifyModes with the Communicator and its index is searched in its notification list and the monitoring mode is set there, otherwise a new CommunicatorNotifyModes is inserted.
If an ObjectWatch exists or is created, a CommunicatorObjNotifyModes with the Communicator and its index is searched in its ObjectWatch::m_CommunicatorObjNotifyModesMap and the monitoring mode is set there, otherwise a new CommunicatorObjNotifyModes is inserted.
Notifications are not initiated directly by the glo::Manager, but are passed on to the WatchNotifyManager via a job, which takes over the notification. In the order are the communicator that triggers the notification, the order type (here OrderMsg::ePROCESS_NOTIFY), the action with the order object (an object ID) in a NotifyInfo and in ZusatzInfo a communicator if necessary.
The WatchNotifyManager checks who wants to be notified about the action on an object and sends an order to them (unless there was a communicator in ZusatzInfo, then only to this communicator) via the glo::Manager (then order type OrderMsg::eNOTIFY_CLIENT ).
The order contains the communicator to be notified, and in a NotifyNote the communicator that triggered the action, the affected object ID and the action.
|
protected |
The standard constructor is not available.
glo::WatchNotifyManager::WatchNotifyManager | ( | Manager * | pMyDBManager | ) |
Constructor with parameter passing.
[in] | pMyDBManager | Backreference to the owning Manager, must not be removed from memory during the lifetime of this object. |
|
virtual |
Destructor, cleaning up.
|
private |
The copy constructor is not available.
|
overridevirtual |
When the thread ends, this virtual method is called. The MsgQueue is cleaned up here.
Reimplemented from eut::RepeatingThread.
|
protected |
Help method for deleteCommunicatorWatches( OrderMsg * ).
All watches of the passed client communicator are removed.
Only the passed list of objects of the type CommunicatorCallBackIndex, which can be used to notify the individual clients about the individual actions, is taken into account.
[in] | pCommunicator | The client communicator whose monitoring is to be removed. |
[in,out] | rActionList | List of objects of the type CommunicatorCallBackIndex via which the individual clients can be notified about the individual actions. |
void glo::WatchNotifyManager::deleteCommunicatorWatches | ( | Communicator * | pCommunicator | ) |
Processes a client communicator delete order from its queue with the orders to be processed.
All monitoring of the client communicator referenced in the order is removed.
All lists of objects of the type CommunicatorCallBackIndex are taken into account.
[in] | pCommunicator | The client communicator. |
|
protected |
Processes a client communicator delete order from its queue with the orders to be processed.
All monitoring of the client communicator referenced in the order is removed.
All lists of objects of the type CommunicatorCallBackIndex are taken into account.
The original order is removed from the memory.
[in] | pOrderMsg | The order. |
|
protected |
In prClassWatch, returns an existing or a new monitoring object for an AllSet with a passed class ID. In any case, the returned monitoring object is in the m_ClassWatchMap.
[in,out] | prClassWatch | The existing or new monitoring object for the AllSet with passed class ID. |
[in] | ulClassID | The class ID. |
[in] | bAlsoGenerate | If true, a new monitoring object for AllSet is then generated and inserted into the m_ClassWatchMap if it does not already exist. If false, only an already existing monitoring object for AllSet is delivered. |
bool glo::WatchNotifyManager::hasObjectWatching | ( | TdWatchNotifyMode | tdWatchNotifyMode | ) | const |
Checks whether objects with the passed observation mode are being monitored.
|
staticprotected |
Inserts a CommunicatorCallBackIndex into the passed list at the beginning.
[in] | pCommunicatorCallBackIndex | CommunicatorCallBackIndex to be inserted. |
[in,out] | rActionList | The list. |
|
private |
The assignment operator is not available.
|
protected |
Processes a notification order from its queue with the orders to be processed.
If necessary, several new notification requests are created and sent to the relevant client communicators.
All lists of objects of the type CommunicatorCallBackIndex are taken into account.
The original order is removed from the memory.
[in] | pOrderMsg | The order. |
|
protected |
Processes a notification order from its queue with the orders to be processed.
If necessary, several new notification requests are created and sent to the relevant client communicators.
Only the passed list of objects of the type CommunicatorCallBackIndex, via which the individual Clients can be notified about the individual actions, is considered.
The original order is removed from the memory.
[in] | pOrderMsg | The order. |
[in,out] | rActionList | List of objects of the type CommunicatorCallBackIndex with which the individual clients can be notified of the individual actions. |
|
protected |
Processes a watch of the passed objects.
[in] | pCommunicator | The client communicator that wants to monitor. |
[in] | rWatchSpecification | The 'watching mode', the 'watching depth' and the 'notification object' |
[in] | rInputList | The object records to watch. |
|
protected |
Processes aunwatch of the passed objects.
[in] | pCommunicator | The client communicator that wants to monitor. |
[in] | rWatchSpecification | The 'watching mode', the 'watching depth' and the 'notification object' |
[in] | rInputList | The object IDs of the objects whose watching is to be stopped. |
|
protected |
Processes a monitoring order or a monitoring cancel order.
[in] | rsSchemaName | The schema name. |
[in] | pCommunicator | The client communicator that wants to initiate or cancel watching. |
[in] | eOrderType | The type of watching. |
[in] | pOrderObject | Depending on the eOrderType, different types or nullptr. |
[in] | pAdditionalInfo | The 'Watch Mode', 'Watch Depth' and 'Notification Object' are always of type WatchSpecification or nullptr. |
|
protected |
Processes a monitoring order or a monitoring cancel order from its queue with the orders to be processed.
After processing, any existing result values are set and the order is returned to the communicator.
[in] | pOrderMsg | The order. |
|
staticprotected |
Removes a CommunicatorCallBackIndex from the passed list.
[in] | pCommunicatorCallBackIndex | CommunicatorCallBackIndex to be removed. |
[in,out] | rActionList | The list. |
|
protected |
Removes and deletes the monitoring object for the AllSet with passed class ID from m_ClassWatchMap
[in] | ulClassID | The class ID. |
|
protected |
Registers a monitoring for an object with possibly dependent objects.
[in] | pCommunicator | The client communicator that wants to monitor. |
[in] | ipCallBack | The address of the CallBack function of the client communicator. |
[in] | rObjID | The object to be monitored. |
[in] | rDependObjectsMap | The dependent objects that are 'co-monitored' by the calling instance. |
[in] | tdWatchNotifyMode | The desired monitoring mode. |
[in] | eDeepMode | The monitoring depth mode to keep the individual DependentObjsWithDeepMode objects apart. |
|
protected |
Registers a client logon-, client logoff-, read index-, write index- or reindex-monitoring.
[in] | pCommunicator | The client communicator that wants to monitor. |
[in] | ipCallBack | The address of the CallBack function of the client communicator. |
[in] | tdWatchNotifyMode | The desired monitoring mode. |
|
protected |
Registers a monitoring for its AllSet.
[in] | pCommunicator | The client communicator that wants to monitor. |
[in] | ipCallBack | The address of the CallBack function of the client communicator. |
[in] | ulClassID | The class ID of the AllSet to be monitored. |
[in] | tdWatchNotifyMode | The desired monitoring mode. |
void glo::WatchNotifyManager::takeOrder | ( | OrderMsg * | pOrderMsg | ) |
Accepts an order.
[in] | pOrderMsg | The order to be processed. |
|
protected |
Deregisters a monitoring for an object with possibly dependent objects.
[in] | pCommunicator | The client communicator that wants to remove monitoring. |
[in] | ipCallBack | The address of the CallBack function of the client communicator. |
[in] | rObjID | The object ID of the object to be monitored. |
[in] | tdWatchNotifyMode | The original desired monitoring mode. |
[in] | eDeepMode | The original monitoring depth mode to keep the individual DependentObjsWithDeepMode objects apart. |
[in] | bSimulate | If true, only simulation is performed, no value is set, but a result or error is returned. |
|
protected |
Deregisters a monitoring for a client logon-, client logoff-, read index-, write index- or reindex
[in] | pCommunicator | The client communicator that wants to remove monitoring. |
[in] | ipCallBack | The address of the CallBack function of the client communicator. |
[in] | tdWatchNotifyMode | The desired monitoring mode. |
[in] | bSimulate | If true, only simulation is performed, no value is set, but a result or error is returned. |
|
protected |
Deregisters a monitoring for an AllSet.
[in] | pCommunicator | The client communicator that wants to remove monitoring. |
[in] | ipCallBack | The address of the CallBack function of the client communicator. |
[in] | ulClassID | The class ID of the AllSet to be monitored. |
[in] | tdWatchNotifyMode | The desired monitoring mode. |
[in] | bSimulate | If true, only simulation is performed, no value is set, but a result or error is returned. |
|
protected |
Help method to unregister the monitoring of dependent objects individually.
[in] | pCommunicator | The client communicator that wants to remove monitoring. |
[in] | ipCallBack | The address of the CallBack function of the client communicator. |
[in] | rDependObjIdStack | List of object IDs of the monitored dependent objects. |
[in] | tdWatchNotifyMode | The watch mode to be canceled. |
[in] | bSimulate | If true, only simulation is performed, no value is set, but a result or error is returned. |
|
overrideprotectedvirtual |
This method is executed as a thread. The message queue is queried for requests and replies to its own requests (the system 'sleeps' until a message is placed in the queue).
Implements eut::RepeatingThread.
|
private |
All ClassWatch sorted by class ID.
|
private |
For monitoring client logon and logoff.
|
private |
Is required to define access protected areas by RepeatingThread::insetExclusiveAccess() or RepeatingThread::unsetExclusiveAccess().
|
private |
For monitoring index read/write/re-index and compressing a database.
|
private |
To increase performance, the individual monitorings are counted.
This allows you to check whether a notification is necessary before sending a notification that a change has occurred.
|
private |
To increase performance, the individual monitorings are counted.
This allows you to check whether a notification is necessary before sending a notification that a change has occurred.
|
private |
To increase performance, the individual monitorings are counted.
This allows you to check whether a notification is necessary before sending a notification that a change has occurred.
|
private |
To increase performance, the individual monitorings are counted.
This allows you to check whether a notification is necessary before sending a notification that a change has occurred.
|
private |
To increase performance, the individual monitorings are counted.
This allows you to check whether a notification is necessary before sending a notification that a change has occurred.
|
private |
The queue with the orders to be processed.
|
staticprotected |
List of objects of the type CommunicatorCallBackIndex via which the individual clients can be notified via client logoff actions to a database.
|
staticprotected |
List of objects of the type CommunicatorCallBackIndex via which the individual clients can be notified via client logon actions to a GloServer.
|
staticprotected |
List of objects of the type CommunicatorCallBackIndex via which the individual clients can be notified via client logoff actions to a GloServer.
|
staticprotected |
List of objects of the type CommunicatorCallBackIndex via which the individual clients can be notified via client logon actions to a database.
|
staticprotected |
List of objects of the type CommunicatorCallBackIndex via which the individual clients can be notified via delete actions on AllSets and objects.
|
staticprotected |
List of objects of the type CommunicatorCallBackIndex via which the individual clients can be notified via read actions to a database.
|
staticprotected |
List of objects of the type CommunicatorCallBackIndex via which the individual clients can be notified via reindex actions to a database.
|
staticprotected |
List of objects of the type CommunicatorCallBackIndex via which the individual clients can be notified via write actions to a database.
|
staticprotected |
List of objects of the type CommunicatorCallBackIndex via which the individual clients can be notified via insert actions on AllSets and objects.
|
staticprotected |
List of objects of the type CommunicatorCallBackIndex via which the individual clients can be notified via lock actions on AllSets and objects.
|
staticprotected |
List of objects of the type CommunicatorCallBackIndex via which the individual clients can be notified via unlock actions on AllSets and objects.
|
staticprotected |
List of objects of the type CommunicatorCallBackIndex via which the individual clients can be notified via write actions on AllSets and objects.