GlobalObjects
Loading...
Searching...
No Matches
glo::Manager Class Reference

The object of this class is the central point of contact for actions that deal with GlobalObjects data. More...

#include <GloManager.h>

Inheritance diagram for glo::Manager:

Classes

struct  ObjIdWithDepends
 A structure to map the object ID of a persistent object with the data records of the dependent objects (dependent means; should be saved, deleted, monitored, locked, etc.). More...
 
class  Receiver
 Is the remote station or the communicator which communicates with the Manager. In multi-user operation there can be several remote stations or communicators. More...
 
class  SchemaMapItem
 Objects of this class represent an open database. There is one object of this class for each open database. More...
 

Public Member Functions

void getAllClients (std::vector< ClientInfo > &rClientInfoVector, std::string *psSchemaName=0) const
 
void getKnownBases (std::vector< std::string > &rKnownBasesVector) const
 
RealIndexPoolgetRealIndexPool ()
 
std::string getSchemaPath () const
 
bool isBaseOpen (Communicator *pCommunicator)
 
int takeOrder (OrderMsg *pOrderMsg)
 
- Public Member Functions inherited from eut::RepeatingThread
 RepeatingThread ()
 
virtual ~RepeatingThread ()
 
virtual void cancel ()
 
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 ()
 

Static Public Member Functions

static Managercreate (const std::string &rsSchemaPath, const std::vector< std::string > &rAllowedSchemes)
 
static int destroy ()
 
static ManagergetAvailableInstance ()
 
static ShowLevel getShowLevel ()
 
static void setActionVisualiser (ManagerActionVisualiser *pActionVisualiser)
 
static void setShowLevel (ShowLevel ulLevel)
 
static void showAction (const OrderMsg *pOrderMsg, const std::string &rsActiontype, const std::string &rsActionString, char cSE)
 
static void showActionString (const std::string &sActionString)
 
static void showOrderAction (OrderMsg *pOrderMsg, char cSE)
 
static void showReaderAction (OrderMsg *pOrderMsg, const std::string &rsActionString, char cSE)
 
static void showTransactionAction (OrderMsg *pOrderMsg, const std::string &rsActionString, char cSE)
 
static void showWriterAction (OrderMsg *pOrderMsg, const std::string &rsActionString, char cSE)
 

Protected Member Functions

 Manager ()
 
 Manager (const std::string &rsSchemaPath, const std::vector< std::string > &rAllowedSchemes)
 
virtual ~Manager ()
 
int checkAllRecordIndices (int iCheckStatus, const SchemaInterface &rSchema, const std::map< ObjID, Record *, std::less< ObjID > > &rRecordMap, IndexPool &rGloIndexPool) const
 
void closeBase (OrderMsg *pOrderMsg)
 
void compressBase (OrderMsg *pOrderMsg)
 
int createSchemaInterface (SchemaInterface *&prNewSchemaInterface, const std::string &rsSchemaName) const
 
void deleteAllObjectsInReceiverMap ()
 
void deleteAllObjectsInSchemaMap ()
 
void deleteCommunicatorWatches (OrderMsg *pOrderMsg)
 
void getAllClients (OrderMsg *pOrderMsg) const
 
void getAllDataTypes (OrderMsg *pOrderMsg) const
 
void getAllKnownBases (OrderMsg *pOrderMsg) const
 
void getAllTransactionIndexPools (std::vector< TransactionIndexPool * > &rTransactionIndexPoolVector, std::string *psSchemaName=0, Communicator *pWithoutThisCommunicator=0) const
 
void getBaseOrSubClassInfos (OrderMsg *pOrderMsg) const
 
void getClassInfo (OrderMsg *pOrderMsg) const
 
void getDataTypeLimits (OrderMsg *pOrderMsg) const
 
void getDependRecords (std::map< ObjID, Record *, std::less< ObjID > > &rDependRecordMap, Record &rSourceRecord, const TableReaderInterface &rTableReaderInterface, EnDeepMode eDeepMode, TransactionOwner *pCommunicatorWithTreadID=nullptr) const
 
void getDependRecordsRecursive (std::map< ObjID, Record *, std::less< ObjID > > &rDependRecordMap, Record &rSourceRecord, const TableReaderInterface &rTableReaderInterface, EnDeepMode eDeepMode, TransactionOwner *pCommunicatorWithTreadID=nullptr) const
 
std::size_t getNumberReceiver () const
 
std::size_t getNumberReceiver (std::string sSchemaName) const
 
Manager::ReceivergetReceiver (Communicator *pCommunicator)
 
int getRecord (Record *&prRetVal, const glo::ObjID &rObjID, const TableReaderInterface &rTableReaderInterface, TransactionOwner *pCommunicatorWithTreadID=nullptr) const
 
SchemaInterfacegetSchemaInterface (const std::string &rsSchemaName) const
 
Manager::SchemaMapItemgetSchemaMapItem (const std::string &rsSchemaName) const
 
void insertInKnownBases (const std::vector< std::string > &rNewSchemes)
 
int lockBaseExclusive (std::ofstream *&prLockFile, const SchemaInterface &rSchemaInterface)
 
void openBase (OrderMsg *pOrderMsg)
 
void processDisconnectedClient (OrderMsg *pOrderMsg)
 
void processNewConnectedClient (OrderMsg *pOrderMsg)
 
void processObjectNotify (TdWatchNotifyMode nWatchNotifyMode, const ObjID &rObjID, Communicator *pCommunicator, const std::string &rsSchemaName)
 
void processObjectNotify (TdWatchNotifyMode nWatchNotifyMode, const std::list< ObjID > &rObjIDList, Communicator *pCommunicator, const std::string &rsSchemaName)
 
void reindexBase (OrderMsg *pOrderMsg)
 
void releaseStrIndexesFromTransactionStepList (std::list< TransactionManager::TransactionBase * > &rTransactionStepList, std::string &rsSchemaName)
 
void removeCommunicator (OrderMsg *pOrderMsg, WatchNotifyManager *pWatchNotifyManager=0)
 
void repairBase (OrderMsg *pOrderMsg)
 
int sendABORTtoTransactionManager (const TransactionOwner &rCommunicatorWithTreadID, std::string sSchemaName)
 
int sendBEGINtoTransactionManager (const TransactionOwner &rCommunicatorWithTreadID)
 
int sendCOMMITtoTransactionManager (const TransactionOwner &rCommunicatorWithTreadID, std::string sSchemaName, std::map< ObjID, Record *, std::less< ObjID > > *pInputDataRecordMap)
 
void sendToLockManager (OrderMsg *pOrderMsg)
 
int sendToLockManager (OrderMsg::EnOrderType eOrderType, SchemaInterface *pSchema, std::list< ObjID > *pObjectIDsToBeLocked, LockSpecification *pLockSpec, const TransactionOwner &rCommunicatorWithTreadID)
 
void sendToReaderThread (OrderMsg *pOrderMsg)
 
void sendToTransactionManager (OrderMsg *pOrderMsg)
 
void sendToWatchNotifyManager (OrderMsg *pOrderMsg)
 
void sendToWriter (OrderMsg *pOrderMsg)
 
void switchOffAllRecieverReader ()
 
void switchOffRecieverReader (std::string sSchemaName)
 
void switchOnAllRecieverReader ()
 
void switchOnRecieverReader (std::string sSchemaName)
 
int transactionManagerSetTransactionStep (const SchemaInterface &rSchema, const TransactionOwner &rCommunicatorWithTreadID, TransactionManager::EnStoreDelete eStoreOrDelete, Record *pRecord)
 
void unlockTransactionStepList (std::list< TransactionManager::TransactionBase * > &rTransactionStepList, const TransactionOwner &rCommunicatorWithTreadID, const std::string &rsSchemaName, TransactionIndexPool *pTransactionIndexPool, bool bDelete)
 
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)
 

Private Member Functions

 Manager (const Manager &)
 
Manageroperator= (const Manager &)
 

Private Attributes

bool m_bWorkingExclusiv
 
std::map< SOCKET, ClientInfo, std::less< SOCKET > > m_ConnectedClientsMap
 
std::vector< std::string > m_KnownSchemes
 
eut::CriticalSection m_LocalCriticalSection
 
std::queue< OrderMsg * > m_MsgQueue
 
LockManagerm_pLockManager
 
RealIndexPoolm_pRealIndexPool
 
TransactionManagerm_pTransactionManager
 
WatchNotifyManagerm_pWatchNotifyManager
 
std::map< Communicator *, Receiver *, std::less< Communicator * > > m_ReceiverMap
 
std::map< std::string, SchemaMapItem *, std::less< std::string > > m_SchemaMap
 
std::string m_strSchemaPath
 
unsigned int m_uiCommunicatorID
 

Static Private Attributes

static ManagerActionVisualiserm_pActionVisualiser
 
static Managerm_pInstance
 
static ShowLevel m_ulShowLevel
 
static int ms_iReferenceCounter
 

Friends

class LockManager
 
class OrderMsg
 
class TableWriterInterface
 
class TcpServerReceiver
 
class WatchNotifyManager
 

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
 

Detailed Description

The object of this class is the central point of contact for actions that deal with GlobalObjects data.

There may only be one object of this class (singleton), which accesses the tables via helper objects using the schema or table interfaces.

Fetches data records from the tables and delivers them to requesting Base(s) or waits for action events of its bases.

Saves, changes or deletes data records in tables.

Instantiates a LockManager and an ObjectWatcher.

A writer thread is instantiated once for each database and a reader thread for each client.

The individual writer and reader threads each process their own message queue.

An IndexPool is instantiated, which builds an index for all bases that can be used by the readers and writers.

If the writer wants to write, all reader threads are stopped and wait until the writer is finished.

When a new CommunicaterThread is instantiated, the required schema is fetched from a list of schemas, copied and then passed to the CommunicaterThread in the constructor. If there is no schema yet, one is instantiated and inserted into the list of schemas. This means that the schema does not need to be read again each time it is used.

Author
Helmut Jakoby

Constructor & Destructor Documentation

◆ Manager() [1/3]

glo::Manager::Manager ( )
protected

The standard constructor is not available.

◆ Manager() [2/3]

glo::Manager::Manager ( const std::string & rsSchemaPath,
const std::vector< std::string > & rAllowedSchemes )
protected

Constructor with parameter transfer; may only be called by Manager::create (...).

Parameters
[in]rsSchemaPathThe file path where the schema files can be found (e.g. "C:/Path/")
[in]rAllowedSchemesThe known schemas or their names.
Exceptions
eut::ErrorNExceptionIn case of an error an exception is thrown.

◆ ~Manager()

virtual glo::Manager::~Manager ( )
protectedvirtual

Destructor.

◆ Manager() [3/3]

glo::Manager::Manager ( const Manager & )
private

The copy constructor is not available.

Member Function Documentation

◆ checkAllRecordIndices()

int glo::Manager::checkAllRecordIndices ( int iCheckStatus,
const SchemaInterface & rSchema,
const std::map< ObjID, Record *, std::less< ObjID > > & rRecordMap,
IndexPool & rGloIndexPool ) const
protected

If iCheckStatus & 1, it is checked if the object IDs in the GloRecords in the rRecordMap in the SchemaIndex of the passed SchemaInterface are all listed as NOT deleted in the passed IndexPool.
If iCheckStatus & 2, for each Record's in the rRecordMap any existing StringIndexes are determined and transferred to the Record's in the rRecordMap.
If iCheckStatus & 4, it is checked whether all Record's in the rRecordMap can be stored with respect to possibly defined unique indexes.

Parameters
[in]iCheckStatusThe check status, see method description.
[in]rSchemaThe affected schema respectively database.
[in]rRecordMapThe set of GloRecords whose ObjID are checked.
[in]rGloIndexPoolThe IndexPool in which the check takes place.
Returns
A return value < 0 indicates an error, i.e. a check has failed.
See also
Record::getAllIndexStrings(), Record::insertInAllIndexStrings (...), Record::getIndexString (...) and Record::m_IndexStrNameTupleVector).

◆ closeBase()

void glo::Manager::closeBase ( OrderMsg * pOrderMsg)
protected

Processes the order to close a specific database (the information is in the order). Removes the corresponding reader or decrements the reference counter of an existing reader of the communicator transferred in the order.

Parameters
[in,out]pOrderMsgThe order to be processed. Any errors that may occur are entered in the order.
See also
OrderMsg::eCLOSE_BASE

◆ compressBase()

void glo::Manager::compressBase ( OrderMsg * pOrderMsg)
protected

Processes the request to compress a specific database. The database is reindexed after compression.

Parameters
[in,out]pOrderMsgThe order to be processed. Any errors that may occur are entered in the order.
Attention
The desired will only succeed if the database is not opened by any instance.
Without prior connection (see also PrivateBase::connect() ) the method fails.
See also
OrderMsg::eCOMPRESS_BASE

◆ create()

static Manager * glo::Manager::create ( const std::string & rsSchemaPath,
const std::vector< std::string > & rAllowedSchemes )
static

Instantiation function. Since Manager is a singleton class, this method instantiates it once and then only returns the pointer to the instance.

Parameters
[in]rsSchemaPathThe file path where the schema files can be found (e.g. "C:/Path/")
[in]rAllowedSchemesThe known schemas or their names.
Exceptions
eut::ErrorNExceptionIn case of an error an exception is thrown.
Attention
The supplied instance must be removed from memory with Manager::destroy()

◆ createSchemaInterface()

int glo::Manager::createSchemaInterface ( SchemaInterface *& prNewSchemaInterface,
const std::string & rsSchemaName ) const
protected

Returns a pointer to a newly instantiated GloSchema interface with the given name, if it exists.

Parameters
[in,out]prNewSchemaInterfacePointer to a newly created SchemaInterface.
[in]rsSchemaNameThe name of the schema respectively database.
Returns
A return value < 0 indicates an error.
Attention
The calling instance must remove the supplied object from memory.

◆ deleteAllObjectsInReceiverMap()

void glo::Manager::deleteAllObjectsInReceiverMap ( )
protected

Removes all elements in the m_ReceiverMap and from memory.

◆ deleteAllObjectsInSchemaMap()

void glo::Manager::deleteAllObjectsInSchemaMap ( )
protected

Removes all elements in the m_SchemaMap and from memory.

◆ deleteCommunicatorWatches()

void glo::Manager::deleteCommunicatorWatches ( OrderMsg * pOrderMsg)
protected

Processes the order to remove all observations of a particular communicator (apparent from the passed order) via the m_pWatchNotifyManager.

Parameters
[in,out]pOrderMsgThe order to be processed. Any errors that may occur are entered in the order.
See also
OrderMsg::eDELETE_COMMUNICATOR_WATCHES

◆ destroy()

static int glo::Manager::destroy ( )
static

If the calling instance is the last one with a reference to the only instance of Manager, that instance of Manager is removed from memory.

Returns
Return is the number of still-references to this instance.

◆ getAllClients() [1/2]

void glo::Manager::getAllClients ( OrderMsg * pOrderMsg) const
protected

Processes the order to insert all ClientInfo's in the order (see also OrderMsg::setOrderResult (...) )

Parameters
[in,out]pOrderMsgThe order to be processed. Any errors that may occur are entered in the order.
See also
OrderMsg::eGET_ALL_CLIENTS

◆ getAllClients() [2/2]

void glo::Manager::getAllClients ( std::vector< ClientInfo > & rClientInfoVector,
std::string * psSchemaName = 0 ) const

Returns all registered communicators.

Parameters
[in,out]rClientInfoVectorThe registered communicators with their communicator ID and the name of the open database.
[in]psSchemaNameIf a pointer to a schema name is passed, only those communicators are returned that have opened the database with this schema name.
See also
OrderMsg::eGET_ALL_CLIENTS

◆ getAllDataTypes()

void glo::Manager::getAllDataTypes ( OrderMsg * pOrderMsg) const
protected

Processes the order to insert all supported data types with their maximum and minimum values (LimitRecord) in the order (see also OrderMsg::setOrderResult (...) )

Parameters
[in,out]pOrderMsgThe order to be processed. Any errors that may occur are entered in the order.
See also
OrderMsg::eGET_ALL_DEFAULT_LIMITS

◆ getAllKnownBases()

void glo::Manager::getAllKnownBases ( OrderMsg * pOrderMsg) const
protected

Processes the order to insert the names of all known schemes or databases in the order (see also OrderMsg::setOrderResult (...) ).

Parameters
[in,out]pOrderMsgThe order to be processed. Any errors that may occur are entered in the order.
See also
OrderMsg::eGET_ALL_BASES

◆ getAllTransactionIndexPools()

void glo::Manager::getAllTransactionIndexPools ( std::vector< TransactionIndexPool * > & rTransactionIndexPoolVector,
std::string * psSchemaName = 0,
Communicator * pWithoutThisCommunicator = 0 ) const
protected

Returns the TransactionIndexPool's from all Receivers in the m_ReceiverMap if they have a TransactionIndexPool.

Parameters
[in,out]rTransactionIndexPoolVectorThe TransactionIndexPool's are inserted here.
[in]psSchemaNameIf this pointer is passed, then only the TransactionIndexPool's whose clients are logged on to the correspondin g database will be delivered.
[in]pWithoutThisCommunicatorIf this pointer is passed, then its possibly existing TransactionIndexPool will not be delivered.
Attention
The TransactionIndexPool's delivered in rTransactionIndexPoolVector must not be removed from memory by the calling instance.

◆ getAvailableInstance()

static Manager * glo::Manager::getAvailableInstance ( )
static

Liefert eine Instanz von Manager, wenn vorhanden. Es wird der Referenzzähler inkrementiert.

Returns
Zeiger auf die einzige Instanz dieser Klasse.
Attention
The supplied instance must be removed from memory with Manager::destroy()

◆ getBaseOrSubClassInfos()

void glo::Manager::getBaseOrSubClassInfos ( OrderMsg * pOrderMsg) const
protected

Processes the order to insert the class information (ClassInfo) of a class, depending on the parameters in the order, all or only the direct subclasses or superclasses in the order (see also OrderMsg::setOrderResult (...) )

Parameters
[in,out]pOrderMsgThe order to be processed. Any errors that may occur are entered in the order.
See also
OrderMsg::eGET_SUBCLASS_INFOS
OrderMsg::eGET_BASECLASS_INFOS
OrderMsg::eGET_ALL_SUBCLASS_INFOS
OrderMsg::eGET_ALL_BASECLASS_INFOS
OrderMsg::eGET_ALL_CLASS_INFOS

◆ getClassInfo()

void glo::Manager::getClassInfo ( OrderMsg * pOrderMsg) const
protected

Processes the order to insert a class information with a certain class ID, which is included in the order (see also OrderMsg::setOrderResult (...) ).

Parameters
[in,out]pOrderMsgThe order to be processed. Any errors that may occur are entered in the order.
See also
OrderMsg::eGET_CLASSINFO_BY_CLASSID, OrderMsg::eGET_CLASSINFO_BY_CLASSNAME, OrderMsg::eIS_KNOWN_CLASSID, OrderMsg::eIS_SUPER_CLASS_FROM

◆ getDataTypeLimits()

void glo::Manager::getDataTypeLimits ( OrderMsg * pOrderMsg) const
protected

Processes the order to insert the maximum and minimum values (LimitRecord) of a supported data type (ClassInfoAttribute::Type) in the order (see also OrderMsg::setOrderResult (...) ).

Parameters
[in,out]pOrderMsgThe order to be processed. Any errors that may occur are entered in the order.
See also
OrderMsg::eGET_DATATYPE_LIMITS

◆ getDependRecords()

void glo::Manager::getDependRecords ( std::map< ObjID, Record *, std::less< ObjID > > & rDependRecordMap,
Record & rSourceRecord,
const TableReaderInterface & rTableReaderInterface,
EnDeepMode eDeepMode,
TransactionOwner * pCommunicatorWithTreadID = nullptr ) const
protected

Returns all dependent records in rDependRecordMap from rSourceRecord depending on the eDeepMode from the tables or glo::TransactionManager.

Parameters
[in,out]rDependRecordMapThe container with the dependent data records.
[in]rSourceRecordThe data record whose dependent data records are expected.
[in]rTableReaderInterfaceThe table reader.
[in]eDeepModeThe action depth mode.
[in]pCommunicatorWithTreadIDWhen a communicator with thread-id is passed, data records to be read (in the recursion) are preferably fetched from the current transaction and only from the tables if they do not exist there.
Note
Is secured by a local eut::CriticalSection.

◆ getDependRecordsRecursive()

void glo::Manager::getDependRecordsRecursive ( std::map< ObjID, Record *, std::less< ObjID > > & rDependRecordMap,
Record & rSourceRecord,
const TableReaderInterface & rTableReaderInterface,
EnDeepMode eDeepMode,
TransactionOwner * pCommunicatorWithTreadID = nullptr ) const
protected

Returns all dependent records in rDependRecordMap from rSourceRecord depending on the eDeepMode from the tables or glo::TransactionManager.

Parameters
[in,out]rDependRecordMapThe container with the dependent data records.
[in]rSourceRecordThe data record whose dependent data records are expected.
[in]rTableReaderInterfaceThe table reader.
[in]eDeepModeThe action depth mode.
[in]pCommunicatorWithTreadIDWhen a communicator with thread-id is passed, data records to be read (in the recursion) are preferably fetched from the current transaction and only from the tables if they do not exist there.
Note
For Glo developers: Is implemented in GloRecordAttributeFunctions.cpp, so that extensions of record attributes can be made there collectively.

◆ getKnownBases()

void glo::Manager::getKnownBases ( std::vector< std::string > & rKnownBasesVector) const

Copies the designations of all known schemas or databases into transferred Vector.

Parameters
[in,out]rKnownBasesVectorThe names of all known schemas or databases.
See also
OrderMsg::eGET_ALL_BASES

◆ getNumberReceiver() [1/2]

std::size_t glo::Manager::getNumberReceiver ( ) const
protected

Returns the number of Receivers in the m_ReceiverMap.

Returns
The number of Receivers.

◆ getNumberReceiver() [2/2]

std::size_t glo::Manager::getNumberReceiver ( std::string sSchemaName) const
protected

Returns the number of Receivers in the m_ReceiverMap whose communicator is logged into a specific database.

Parameters
[in]sSchemaNameThe name of the schema respectively database.
Returns
The number of Receivers.

◆ getRealIndexPool()

RealIndexPool * glo::Manager::getRealIndexPool ( )

Returns the real IndexPool.

Returns
The real IndexPool.
Attention
The calling instance must not remove the returned object from memory. It only lives as long as this object.

◆ getReceiver()

Manager::Receiver * glo::Manager::getReceiver ( Communicator * pCommunicator)
protected

Returns a Receiver with reference to a specific communicator from the m_ReceiverMap.

Parameters
[in]pCommunicatorThe communicator.
Returns
The Receiver found, if any.
Attention
The delivered object must not be removed from memory by the calling instance.

◆ getRecord()

int glo::Manager::getRecord ( Record *& prRetVal,
const glo::ObjID & rObjID,
const TableReaderInterface & rTableReaderInterface,
TransactionOwner * pCommunicatorWithTreadID = nullptr ) const
protected

Returns a data record from the tables or from the glo::TransactionManager with the object ID passed.

Parameters
[in,out]prRetValThe data record.
[in]rObjIDThe object ID of the data record.
[in]rTableReaderInterfaceThe table reader.
[in]pCommunicatorWithTreadIDIf a communicator with thread-id is passed, the data record to be read is preferably fetched from the current transaction and only from the tables if it is not available there.
Returns
A return < 0 indicates an error.
Attention
The calling instance must remove the possibly supplied record from memory with Record::forget().

◆ getSchemaInterface()

SchemaInterface * glo::Manager::getSchemaInterface ( const std::string & rsSchemaName) const
protected

Returns a pointer to a SchemaInterface with the given name from the m_SchemaMap.

Parameters
[in]rsSchemaNameThe name of the schema respectively database.
Returns
The found SchemaInterface, otherwise 0.
Attention
The calling instance must not remove the supplied object from memory.

◆ getSchemaMapItem()

Manager::SchemaMapItem * glo::Manager::getSchemaMapItem ( const std::string & rsSchemaName) const
protected

Returns a pointer to a SchemaMapItem with the passed name of its schema from the m_SchemaMap.

Parameters
[in]rsSchemaNameThe name of the schema respectively database.
Returns
The found SchemaMapItem, otherwise 0.
Attention
The calling instance must not remove the supplied object from memory.

◆ getSchemaPath()

std::string glo::Manager::getSchemaPath ( ) const

Returns the file path where the schema file can be found.

Returns
Complete path name (e.g. "C:/Path/").

◆ getShowLevel()

static ShowLevel glo::Manager::getShowLevel ( )
static

Returns the display setting.

Returns
The display setting.

◆ insertInKnownBases()

void glo::Manager::insertInKnownBases ( const std::vector< std::string > & rNewSchemes)
protected

Inserts passed database names into m_KnownSchemes if not already present.

Parameters
[in]rNewSchemesThe name of the schema respectively database.

◆ isBaseOpen()

bool glo::Manager::isBaseOpen ( Communicator * pCommunicator)

Checks if passed communicator has opened a database or if a corresponding Receiver is available in the m_ReceiverMap.

Returns
Returns true if the given communicator has opened a database.

◆ lockBaseExclusive()

int glo::Manager::lockBaseExclusive ( std::ofstream *& prLockFile,
const SchemaInterface & rSchemaInterface )
protected

Returns, if not yet opened, the LockFile of the database, apparent from the passed rSchemaInterface.

Parameters
[in,out]prLockFileThe LockFile opened once.
[in]rSchemaInterfaceThe schema whose database should be locked by the LogFile.
Returns
A return value < 0 indicates an error, e.g. ERR_BASE_LOCKED if file already locked.
Attention
The delivered object must be removed from memory by the calling instance.

◆ openBase()

void glo::Manager::openBase ( OrderMsg * pOrderMsg)
protected

Processes the order to open a specific database (the information is in the order) and insert the communicator ID in the order (see also OrderMsg::setOrderResult (...) ). Instantiates a reader or increments the reference counter of an existing reader for the communicator passed in the order.

Parameters
[in,out]pOrderMsgThe order to be processed. Any errors that may occur are entered in the order.
See also
OrderMsg::eOPEN_BASE

◆ operator=()

Manager & glo::Manager::operator= ( const Manager & )
private

The assignment operator is not available.

◆ processDisconnectedClient()

void glo::Manager::processDisconnectedClient ( OrderMsg * pOrderMsg)
protected

Processes the request to remove a client (apparent from the passed order) from its m_ConnectedClientsMap

Parameters
[in,out]pOrderMsgThe order to be processed. Any errors that may occur are entered in the order.
See also
OrderMsg::eDISCONNECTED_CLIENT

◆ processNewConnectedClient()

void glo::Manager::processNewConnectedClient ( OrderMsg * pOrderMsg)
protected

Processes the request to add a new client (apparent from the passed order) to its m_ConnectedClientsMap

Parameters
[in,out]pOrderMsgThe order to be processed. Any errors that may occur are entered in the order.
See also
OrderMsg::eNEW_CONNECTED_CLIENT

◆ processObjectNotify() [1/2]

void glo::Manager::processObjectNotify ( TdWatchNotifyMode nWatchNotifyMode,
const ObjID & rObjID,
Communicator * pCommunicator,
const std::string & rsSchemaName )
protected

Initiates a Notify in the m_pWatchNotifyManager via its m_MsgQueue, which affects an object.

Parameters
[in]nWatchNotifyModeThe watch mode.
[in]rObjIDThe Object-ID of the affected object.
[in]pCommunicatorThe communicator.
[in]rsSchemaNameThe schema name is used for notification.

◆ processObjectNotify() [2/2]

void glo::Manager::processObjectNotify ( TdWatchNotifyMode nWatchNotifyMode,
const std::list< ObjID > & rObjIDList,
Communicator * pCommunicator,
const std::string & rsSchemaName )
protected

Initiates via its m_MsgQueue Notify's in the m_pWatchNotifyManager, which affects the objects with the object IDs from rObjIDList.

Parameters
[in]nWatchNotifyModeThe watch mode.
[in]rObjIDListThe Object-IDs of the affected objects.
[in]pCommunicatorThe communicator.
[in]rsSchemaNameThe schema name is used for notification.

◆ reindexBase()

void glo::Manager::reindexBase ( OrderMsg * pOrderMsg)
protected

Processes the request to reindex a specific database.

Parameters
[in,out]pOrderMsgThe order to be processed. Any errors that may occur are entered in the order.
Attention
The desired will only succeed if the database is not opened by any instance.
Without prior connection (see also PrivateBase::connect() ) the method fails.
See also
OrderMsg::eREINDEX_BASE

◆ releaseStrIndexesFromTransactionStepList()

void glo::Manager::releaseStrIndexesFromTransactionStepList ( std::list< TransactionManager::TransactionBase * > & rTransactionStepList,
std::string & rsSchemaName )
protected

All reserved string indexes in the RealIndexPool and all TransactionIndexPools that were reserved by the TransactionManager::TransactionStep's in the parameter rTransactionStepList are released.

Parameters
[in]rTransactionStepListThe list with the TransactionManager::TransactionPoint's and TransactionManager::TransactionStep's (the transaction history).
[in]rsSchemaNameName of the schema respectively database.
See also
IndexPool::releaseObjStrIdTuple (...)

◆ removeCommunicator()

void glo::Manager::removeCommunicator ( OrderMsg * pOrderMsg,
WatchNotifyManager * pWatchNotifyManager = 0 )
protected

Processes the request to remove a specific communicator (apparent from the passed order). This means that all orders from the communicator that have not yet been processed are discarded.

Parameters
[in,out]pOrderMsgThe order to be processed. Any errors that may occur are entered in the order.
[in]pWatchNotifyManagerIf a pointer is passed to a WatchNotifyManager, orders still existing there are also cancelled.
See also
OrderMsg::eCLOSE_BASE
OrderMsg::eDELETE_COMMUNICATOR_WATCHES
OrderMsg::eNOTIFY_CLIENT

◆ repairBase()

void glo::Manager::repairBase ( OrderMsg * pOrderMsg)
protected

Processes the request to repair a specific database.

Parameters
[in,out]pOrderMsgThe order to be processed. Any errors that may occur are entered in the order.
Attention
The desired will only succeed if the database is not opened by any instance.
Without prior connection (see also PrivateBase::connect() ) the method fails.
See also
OrderMsg::eREPAIR_BASE

◆ sendABORTtoTransactionManager()

int glo::Manager::sendABORTtoTransactionManager ( const TransactionOwner & rCommunicatorWithTreadID,
std::string sSchemaName )
protected

Makes the glo::TransactionManager handle the abort of a communicator's transaction.
Called by void sendToTransactionManager(OrderMsg*).

Parameters
[in]rCommunicatorWithTreadIDThe commissioning communicator with thread-id.
[in]sSchemaNameThe name of the schema respectively database.
Returns
A return value < 0 indicates an error.

◆ sendBEGINtoTransactionManager()

int glo::Manager::sendBEGINtoTransactionManager ( const TransactionOwner & rCommunicatorWithTreadID)
protected

Makes the glo::TransactionManager handle the start of a communicator's transaction.
Called by void sendToTransactionManager(OrderMsg*).

Parameters
[in]rCommunicatorWithTreadIDThe commissioning communicator with thread-id.
Returns
A return value < 0 indicates an error.

◆ sendCOMMITtoTransactionManager()

int glo::Manager::sendCOMMITtoTransactionManager ( const TransactionOwner & rCommunicatorWithTreadID,
std::string sSchemaName,
std::map< ObjID, Record *, std::less< ObjID > > * pInputDataRecordMap )
protected

Makes the glo::TransactionManager process the completion of a communicator's transaction.
Called by void sendToTransactionManager(OrderMsg*).

Parameters
[in]rCommunicatorWithTreadIDThe commissioning communicator with thread-id.
[in]sSchemaNameThe name of the schema respectively database.
[in]pInputDataRecordMapIf not nullptr, then there are records with attributes without file position that are set.
Returns
A return value < 0 indicates an error.

◆ sendToLockManager() [1/2]

void glo::Manager::sendToLockManager ( OrderMsg * pOrderMsg)
protected

Processes an order for the LockManager in m_pLockManager.

Parameters
[in,out]pOrderMsgThe order to be processed. Any errors that may occur are entered in the order.
See also
OrderMsg::eLOCK
OrderMsg::eUNLOCK
OrderMsg::eIS_LOCKED
OrderMsg::eIS_ALLOWED
OrderMsg::eGET_PROCESSING_POSSIBILITIES

◆ sendToLockManager() [2/2]

int glo::Manager::sendToLockManager ( OrderMsg::EnOrderType eOrderType,
SchemaInterface * pSchema,
std::list< ObjID > * pObjectIDsToBeLocked,
LockSpecification * pLockSpec,
const TransactionOwner & rCommunicatorWithTreadID )
protected

Processes an order for the LockManager in m_pLockManager.

Parameters
[in]eOrderTypeThe type of processing.
Allowed are:

◆ sendToReaderThread()

◆ sendToTransactionManager()

void glo::Manager::sendToTransactionManager ( OrderMsg * pOrderMsg)
protected

Processes an order for the TransactionManager in m_pTransactionManager.

Parameters
[in,out]pOrderMsgThe order to be processed. Any errors that may occur are entered in the order.
See also
OrderMsg::eSTORE
OrderMsg::eDELETE
OrderMsg::eBEGIN_TRANSACTION
OrderMsg::eCOMMIT_TRANSACTION
OrderMsg::eABORT_TRANSACTION

◆ sendToWatchNotifyManager()

void glo::Manager::sendToWatchNotifyManager ( OrderMsg * pOrderMsg)
protected

◆ sendToWriter()

void glo::Manager::sendToWriter ( OrderMsg * pOrderMsg)
protected

Processes an order for a TableWriterInterface via the SchemaMapItem in m_SchemaMap or for the TransactionManager in m_pTransactionManager.

When an order is sent to the TableWriterInterface, first all ReaderThreads are stopped, then the order is processed and then the ReaderThreads are restarted.

Parameters
[in,out]pOrderMsgThe order to be processed. Any errors that may occur are entered in the order.
See also
OrderMsg::eASSIGN

◆ setActionVisualiser()

static void glo::Manager::setActionVisualiser ( ManagerActionVisualiser * pActionVisualiser)
static

Accepts a display object to display its actions depending on the m_ulShowLevel.

Parameters
[in]pActionVisualiserThe display object.
Attention
The transferred display object becomes the property of this object, ergo may no longer be removed from the memory by the transmitting instance, this is done by this instance.

◆ setShowLevel()

static void glo::Manager::setShowLevel ( ShowLevel ulLevel)
static

Sets the display setting.

Parameters
[in]ulLevelThe display setting.

◆ showAction()

static void glo::Manager::showAction ( const OrderMsg * pOrderMsg,
const std::string & rsActiontype,
const std::string & rsActionString,
char cSE )
static

Lets the display object in m_pActionVisualiser display a request action if it exists.

Parameters
[in]pOrderMsgThe order with the communicator ID and communicator name for the ad.
[in]rsActiontypeThe type of the ad as string.
[in]rsActionStringThe action as string.
[in]cSEAn addition such as a direction indicator (e.g. '<' or '>').

◆ showActionString()

static void glo::Manager::showActionString ( const std::string & sActionString)
static

Lets the display object in m_pActionVisualiser display a request action if it exists.

Parameters
[in]sActionStringThe text to be displayed,

◆ showOrderAction()

static void glo::Manager::showOrderAction ( OrderMsg * pOrderMsg,
char cSE )
static

Lets the display object in m_pActionVisualiser display a request action if it exists.

Parameters
[in]pOrderMsgThe order with the communicator ID and communicator name for the ad.
[in]cSEAn addition such as a direction indicator (e.g. '<' or '>').

◆ showReaderAction()

static void glo::Manager::showReaderAction ( OrderMsg * pOrderMsg,
const std::string & rsActionString,
char cSE )
static

Lets the display object in m_pActionVisualiser, if it exists, display a read action in the database.

Parameters
[in]pOrderMsgThe order with the communicator ID and communicator name for the ad.
[in]rsActionStringThe action as string.
[in]cSEAn addition such as a direction indicator (e.g. '<' or '>').

◆ showTransactionAction()

static void glo::Manager::showTransactionAction ( OrderMsg * pOrderMsg,
const std::string & rsActionString,
char cSE )
static

If the display object in m_pActionVisualiser exists, it will display a transaction action in the database.

Parameters
[in]pOrderMsgThe order with the communicator ID and communicator name for the ad.
[in]rsActionStringThe action as string.
[in]cSEAn addition such as a direction indicator (e.g. '[', ']' or 'X').

◆ showWriterAction()

static void glo::Manager::showWriterAction ( OrderMsg * pOrderMsg,
const std::string & rsActionString,
char cSE )
static

If the display object in m_pActionVisualiser exists, it will display a write action in the database.

Parameters
[in]pOrderMsgThe order with the communicator ID and communicator name for the ad.
[in]rsActionStringThe action as string.
[in]cSEAn addition such as a direction indicator (e.g. '<' or '>').

◆ switchOffAllRecieverReader()

void glo::Manager::switchOffAllRecieverReader ( )
protected

Lets all Receivers in the m_ReceiverMap take a break.

◆ switchOffRecieverReader()

void glo::Manager::switchOffRecieverReader ( std::string sSchemaName)
protected

Lets all Receivers in the Manager::m_ReceiverMap whose communicators are logged into a specific database pause.

This is used, for example, to write data to the tables during the read pause.

Parameters
[in]sSchemaNameThe name of the schema respectively database.

◆ switchOnAllRecieverReader()

void glo::Manager::switchOnAllRecieverReader ( )
protected

Lets all Receivers in the m_ReceiverMap finish a break.

◆ switchOnRecieverReader()

void glo::Manager::switchOnRecieverReader ( std::string sSchemaName)
protected

Lets all Receivers in the m_ReceiverMap whose communicators are logged into a specific database finish a break.

This is used, for example, to write data to the tables during the read pause.

Parameters
[in]sSchemaNameThe name of the schema respectively database.

◆ takeOrder()

int glo::Manager::takeOrder ( OrderMsg * pOrderMsg)

Accepts an order.

Parameters
[in]pOrderMsgThe order to be processed.

◆ transactionManagerSetTransactionStep()

int glo::Manager::transactionManagerSetTransactionStep ( const SchemaInterface & rSchema,
const TransactionOwner & rCommunicatorWithTreadID,
TransactionManager::EnStoreDelete eStoreOrDelete,
Record * pRecord )
protected

Sets a transaction step from sendToTransactionManager (...) in m_pTransactionManager.

Parameters
[in]rSchemaThe schema of the affected database.
[in]TransactionOwnerThe affected communicator with tread-ID.
[in]eStoreOrDeleteSave or delete.
[in]pRecordThe data record to be saved or deleted in the transaction.
Returns
A return < 0 indicates an error.
See also
TransactionManager->setTransactionStep (...)

◆ unlockTransactionStepList()

void glo::Manager::unlockTransactionStepList ( std::list< TransactionManager::TransactionBase * > & rTransactionStepList,
const TransactionOwner & rCommunicatorWithTreadID,
const std::string & rsSchemaName,
TransactionIndexPool * pTransactionIndexPool,
bool bDelete )
protected

All locked records in the rTransactionStepList are released in the m_pLockManager.

Parameters
[in]rTransactionStepListThe list with the TransactionManager::TransactionPoint's and TransactionManager::TransactionStep's (the transaction history).
[in]rCommunicatorWithTreadIDThe communicator with thread-is that 'owns' the transaction. Is needed here to lock the records.
[in]rsSchemaNameName of the schema respectively database.
[in]pTransactionIndexPoolIf a pointer to a TransactionIndexPool is passed, the object ID of a deleted object is removed there.
[in]bDeleteIf bDelete is true, the respective TransactionManager::TransactionStep is removed from the memory and thus the contained record is 'forgotten'.
See also
LockManager::unlockObject (...)
TransactionIndexPool::removeTransactionDeletedObjID (...)

◆ work()

virtual void glo::Manager::work ( )
overrideprotectedvirtual

This method is executed as a thread. The message queue is queried for requests (the system 'sleeps' until a message is placed in the queue) and after evaluating the request, a suitable method is called.

Implements eut::RepeatingThread.

Friends And Related Symbol Documentation

◆ LockManager

friend class LockManager
friend

◆ OrderMsg

friend class OrderMsg
friend

◆ TableWriterInterface

friend class TableWriterInterface
friend

◆ TcpServerReceiver

friend class TcpServerReceiver
friend

◆ WatchNotifyManager

friend class WatchNotifyManager
friend

Member Data Documentation

◆ m_bWorkingExclusiv

bool glo::Manager::m_bWorkingExclusiv
private

Becomes true when a database is closed. In this case, orders are no longer processed until false again.

◆ m_ConnectedClientsMap

std::map< SOCKET, ClientInfo , std::less< SOCKET > > glo::Manager::m_ConnectedClientsMap
private

List of communicators, which are connected to the Server.

◆ m_KnownSchemes

std::vector<std::string> glo::Manager::m_KnownSchemes
private

The known schemes or their names.

◆ m_LocalCriticalSection

eut::CriticalSection glo::Manager::m_LocalCriticalSection
private

To ensure thread-safe access to the elements of the Manager, access is synchronized via this local CriticalSection.

◆ m_MsgQueue

std::queue< OrderMsg * > glo::Manager::m_MsgQueue
private

The queue with the orders to be processed.

◆ m_pActionVisualiser

ManagerActionVisualiser* glo::Manager::m_pActionVisualiser
staticprivate

The display object.

◆ m_pInstance

Manager* glo::Manager::m_pInstance
staticprivate

Static pointer to the only instance of this class.

◆ m_pLockManager

LockManager* glo::Manager::m_pLockManager
private

Manages the locks of the individual objects.

◆ m_pRealIndexPool

RealIndexPool* glo::Manager::m_pRealIndexPool
private

Manages the indexes of each open database.

◆ m_pTransactionManager

TransactionManager* glo::Manager::m_pTransactionManager
private

Manages the transactions of the individual communicators.

◆ m_pWatchNotifyManager

WatchNotifyManager* glo::Manager::m_pWatchNotifyManager
private

Manages the monitoring of the individual communicators.

◆ m_ReceiverMap

std::map< Communicator *, Receiver * , std::less< Communicator * > > glo::Manager::m_ReceiverMap
private

List of communicators with open database, which communicate with the Manager.

◆ m_SchemaMap

std::map< std::string, SchemaMapItem *, std::less< std::string > > glo::Manager::m_SchemaMap
private

The schema interfaces in a SchemaMapItem, sorted by the schema name or database name

◆ m_strSchemaPath

std::string glo::Manager::m_strSchemaPath
private

The file path where the schema files can be found (e.g. "C:/Path/")

◆ m_uiCommunicatorID

unsigned int glo::Manager::m_uiCommunicatorID
private

Is counted up and given to every registering communicator as ID.

◆ m_ulShowLevel

ShowLevel glo::Manager::m_ulShowLevel
staticprivate

The display output setting.

◆ ms_iReferenceCounter

int glo::Manager::ms_iReferenceCounter
staticprivate

The reference counter to the only instance of this class.


The documentation for this class was generated from the following file: