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

The real index as opposed to the TransactionIndexPool, which is created for each transaction More...

#include <GloRealIndexPool.h>

Inheritance diagram for glo::RealIndexPool:

Public Member Functions

 RealIndexPool ()
 
 RealIndexPool (const RealIndexPool &rT)
 
virtual ~RealIndexPool ()
 
virtual bool existsSchemaIndex (const std::string &rsSchemaName) const
 
virtual int getFreeObjIDPos (std::streampos &rPos, const std::string &rsSchemaName, unsigned long ulClassID) const
 
std::size_t getNumberOfClassInfos (const SchemaInterface &rSchemaInterface) const
 
std::size_t getNumberOfIndexes (const SchemaInterface &rSchemaInterface) const
 
virtual int insertFreeObjIDPos (const std::string &rsSchemaName, unsigned long ulClassID, std::streampos Pos)
 
void notifyIndexReadWrite (TdWatchNotifyMode iMode, const std::string &rsSchemaName, const ObjID &rObjID, int iFraction, int iActions)
 
RealIndexPooloperator= (const RealIndexPool &rT)
 
int readIndexes (const SchemaInterface &rSchemaInterface)
 
int reindex (const SchemaInterface &rSchemaInterface)
 
int reindex (const SchemaInterface &rSchemaInterface, int iActions)
 
int reindexObjIDIndexes (const SchemaInterface &rSchemaInterface)
 
int reindexObjStrIndexes (const SchemaInterface &rSchemaInterface)
 
virtual int removeFreeObjIDPos (const std::string &rsSchemaName, unsigned long ulClassID, std::streampos Pos)
 
int removeSchemaIndex (const std::string &rsSchemaName)
 
void setWatchNotifyManager (WatchNotifyManager *pWatchNotifyManager)
 
int writeIndexes (const SchemaInterface &rSchemaInterface)
 
int writeIndexes (const SchemaInterface &rSchemaInterface, int iActions)
 
int writeObjIDIndexes (const SchemaInterface &rSchemaInterface) const
 
int writeObjStrIndexes (const SchemaInterface &rSchemaInterface) const
 
- Public Member Functions inherited from glo::IndexPool
 IndexPool ()
 
 IndexPool (const IndexPool &rT)
 
virtual ~IndexPool ()
 
void deleteAllSchemaIndexValues ()
 
virtual int getObjectStrIndexIterator (ObjectStrIndexIterator *&prObjectStrIndexIterators, const std::string &rsSchemaName, unsigned long ulClassID, const std::string &rsIndexName) const
 
virtual int getObjIdPosTuple (ObjIdPosTuple *&prRetVal, const std::string &rsSchemaName, unsigned long ulClassID, const ObjID &rObjID) const
 
virtual int getTableObjIdIndexIterator (TableObjIdIndexIterator *&prTableIterators, const std::string &rsSchemaName, unsigned long ulClassID) const
 
virtual int insertDeletedObjID (const std::string &rsSchemaName, const ObjID &rDeletedObjId)
 
virtual int insertObjIdPosTuple (const std::string &rsSchemaName, unsigned long ulClassID, const ObjIdPosTuple &rIndexTuple)
 
virtual int insertObjStrIdTuple (const std::string &rsSchemaName, unsigned long ulClassID, const std::string &rsIndexName, const ObjStrIdTuple &rIndexTuple)
 
virtual int isIndexFree (const std::string &rsSchemaName, unsigned long ulClassID, const ObjID &rObjID, const std::string &rsIndexName, const std::string &rsIndex) const
 
virtual bool isObjIdDeleted (const std::string &rsSchemaName, const ObjID &rObjID) const
 
virtual int isObjIdFree (const std::string &rsSchemaName, const ObjID &rObjID) const
 
IndexPooloperator= (const IndexPool &rT)
 
int releaseAllCommunicatorObjStrIdTuples (const std::string &rsSchemaName, const NUM_PTR ipReservingComunicator)
 
int releaseObjStrIdTuple (const std::string &rsSchemaName, unsigned long ulClassID, const std::string &rsIndexName, const NUM_PTR ipReservingComunicatorTrx)
 
virtual int removeObjId (const std::string &rsSchemaName, unsigned long ulClassID, const ObjID &rObjID)
 
virtual int removeObjStrIdTuple (const std::string &rsSchemaName, unsigned long ulClassID, const std::string &rsIndexName, const ObjID &rObjID, NUM_PTR ipReservingComunicatorTrx=0)
 
int reserveObjStrIdTuple (const std::string &rsSchemaName, unsigned long ulClassID, const std::string &rsIndexName, const ObjStrIdTuple &rIndexTuple)
 

Protected Member Functions

int _createObjIDIndexFromTable (const SchemaInterface &rSchemaInterface, const ClassInfoAttribute &rClassInfoAttribute)
 
int _createObjStrIndexFromTables (const SchemaInterface &rSchemaInterface, const ClassInfoIndex &rClassInfoIndex)
 
int _getIndexString (std::string &rsRetValIndex, const std::vector< eut::LanguageFunctions::EnLanguageKey > &rLanguageKeys, bool bCaseSensitive, const SchemaInterface &rSchemaInterface, unsigned long ulClassID, const ObjID &rObjID, const ClassInfoIndex::IndexAttributeItem &rIndexAttributeItem)
 
int _readObjIDIndexes (const SchemaInterface &rSchemaInterface)
 
int _readObjStrIndexes (const SchemaInterface &rSchemaInterface)
 
int _reindexObjIDIndexes (const SchemaInterface &rSchemaInterface)
 
int _reindexObjStrIndexes (const SchemaInterface &rSchemaInterface)
 
int _writeObjIDIndexes (const SchemaIndex &rSchemaIndex) const
 
int _writeObjIDIndexes (const SchemaInterface &rSchemaInterface) const
 
int _writeObjStrIndexes (const SchemaIndex &rSchemaIndex) const
 
int _writeObjStrIndexes (const SchemaInterface &rSchemaInterface) const
 
- Protected Member Functions inherited from glo::IndexPool
void _deleteAllSchemaIndexValues ()
 
virtual bool _existsSchemaIndex (const std::string &rsSchemaName) const
 
virtual int _getFreeObjIDPos (std::streampos &rPos, const std::string &rsSchemaName, unsigned long ulClassID) const
 
virtual int _getObjectStrIndex (ObjectStrIndex *&prRetVal, const std::string &rsSchemaName, unsigned long ulClassID, const std::string &rsIndexName) const
 
virtual int _getObjectStrIndexIterator (ObjectStrIndexIterator *&prObjStrIterators, const std::string &rsSchemaName, unsigned long ulClassID, const std::string &rsIndexName) const
 
virtual int _getObjIdPosTuple (ObjIdPosTuple *&prRetVal, const std::string &rsSchemaName, unsigned long ulClassID, const ObjID &rObjID) const
 
virtual int _getSchemaIndex (SchemaIndex *&prRetVal, const std::string &rsSchemaName) const
 
virtual int _getTableObjIdIndex (TableObjIdIndex *&prRetVal, const std::string &rsSchemaName, unsigned long ulClassID) const
 
virtual int _getTableObjIdIndexIterator (TableObjIdIndexIterator *&prTableIterators, const std::string &rsSchemaName, unsigned long ulClassID) const
 
virtual int _insertDeletedObjID (const std::string &rsSchemaName, const ObjID &rDeletedObjId)
 
virtual int _insertFreeObjIDPos (const std::string &rsSchemaName, unsigned long ulClassID, std::streampos Pos)
 
virtual int _insertObjIdPosTuple (const std::string &rsSchemaName, unsigned long ulClassID, const ObjIdPosTuple &rIndexTuple)
 
virtual int _insertObjStrIdTuple (const std::string &rsSchemaName, unsigned long ulClassID, const std::string &rsIndexName, const ObjStrIdTuple &rIndexTuple)
 
virtual bool _isObjIdDeleted (const std::string &rsSchemaName, const ObjID &rObjID) const
 
virtual int _isObjIdFree (const std::string &rsSchemaName, unsigned long ulClassID, const ObjID &rObjID) const
 
virtual int _makeObjectStrIndex (const std::string &rsSchemaName, const std::string &rsTablePathName, unsigned long ulClassID, const std::string &rsIndexName, bool bUnique)
 
virtual int _makeTableObjIdIndex (const std::string &rsSchemaName, const std::string &rsTablePathName, unsigned long ulClassID)
 
virtual int _removeFreeObjIDPos (const std::string &rsSchemaName, unsigned long ulClassID, std::streampos Pos)
 
int _removeSchemaIndex (const std::string &rsSchemaName)
 
void copyMapFrom (const IndexPool &rT)
 

Private Attributes

int m_iActions
 
WatchNotifyManagerm_pWatchNotifyManager
 

Additional Inherited Members

- Protected Attributes inherited from glo::IndexPool
eut::CriticalSection m_LocalCriticalSection
 
std::map< std::string, SchemaIndex *, std::less< std::string > > m_SchemaIndexMap
 

Detailed Description

The real index as opposed to the TransactionIndexPool, which is created for each transaction

Author
Helmut Jakoby

Constructor & Destructor Documentation

◆ RealIndexPool() [1/2]

glo::RealIndexPool::RealIndexPool ( )

Standard constructor.

◆ RealIndexPool() [2/2]

glo::RealIndexPool::RealIndexPool ( const RealIndexPool & rT)

Copy constructor.

Parameters
[in]rTThe data is copied from this object.

◆ ~RealIndexPool()

virtual glo::RealIndexPool::~RealIndexPool ( )
virtual

Destructor.

Member Function Documentation

◆ _createObjIDIndexFromTable()

int glo::RealIndexPool::_createObjIDIndexFromTable ( const SchemaInterface & rSchemaInterface,
const ClassInfoAttribute & rClassInfoAttribute )
protected

Generates a TableObjIdIndex from the data of an object table.

Parameters
[in]rSchemaInterfaceFor schema name and the path to the tables.
[in]rClassInfoAttributeFor table name and ClassID.
Returns
A return value < 0 indicates an error.

◆ _createObjStrIndexFromTables()

int glo::RealIndexPool::_createObjStrIndexFromTables ( const SchemaInterface & rSchemaInterface,
const ClassInfoIndex & rClassInfoIndex )
protected

Generates a ObjectStrIndex from the data of an object table.

Parameters
[in]rSchemaInterfaceFor the schema name and the path to the tables.
[in]rClassInfoIndexFor table name and ClassID.
Returns
A return value < 0 indicates an error.

◆ _getIndexString()

int glo::RealIndexPool::_getIndexString ( std::string & rsRetValIndex,
const std::vector< eut::LanguageFunctions::EnLanguageKey > & rLanguageKeys,
bool bCaseSensitive,
const SchemaInterface & rSchemaInterface,
unsigned long ulClassID,
const ObjID & rObjID,
const ClassInfoIndex::IndexAttributeItem & rIndexAttributeItem )
protected

Returns the index string from passed Class ID, Object ID and ClassInfoIndex::IndexAttributeItem.
The passed class ID indicates in which table a record with the passed ObjID can be found.
The first AttributeID in ClassInfoIndex::IndexAttributeItem determines the data field. If there is a second AttributeID in ClassInfoIndex::IndexAttributeItem, the data field must contain an object ID (otherwise error) and the same method is called recursively.
Otherwise the entry in the data field is returned as a string in the specified length and form.

Parameters
[in,out]rsRetValIndexThe resulting string.
[in]rLanguageKeysThe language keys in a vector.
[in]bCaseSensitiveIf false, all characters in the rsRetValIndex are converted to upper case.
[in]rSchemaInterfaceFor the schema name and the path to the tables.
[in]ulClassIDThe class ID specifies the table to be searched.
[in]rObjIDThe objectID of the object.
[in]rIndexAttributeItemThe information which attribute is to be taken.
Returns
A return value < 0 indicates an error.

◆ _readObjIDIndexes()

int glo::RealIndexPool::_readObjIDIndexes ( const SchemaInterface & rSchemaInterface)
protected

Reads all objects of type TableObjIdIndex of a database from the file system (ODX and FDX files) into memory. The read files are deleted so that it can be determined whether the current index was written after a crash of the GlobalObjects application.

Parameters
[in]rSchemaInterfaceThe schema interface represents the database.
Returns
A return value < 0 indicates an error.
Attention
If a required xDX file is not available, a IndexPool::reindexObjIDIndexes (...) should be initiated.

◆ _readObjStrIndexes()

int glo::RealIndexPool::_readObjStrIndexes ( const SchemaInterface & rSchemaInterface)
protected

Reads all objects of type ObjectStrIndex of a database from the file system (SDX files) into memory. The read files are deleted so that it can be determined whether the current index was written after a crash of the GlobalObjects application.

Parameters
[in]rSchemaInterfaceThe schema interface represents the database.
Returns
A return value < 0 indicates an error.
Attention
If a required SDX file is not available, a IndexPool::reindexObjStrIndexes (...) should be initiated.

◆ _reindexObjIDIndexes()

int glo::RealIndexPool::_reindexObjIDIndexes ( const SchemaInterface & rSchemaInterface)
protected

Reindexes all objects of type TableObjIdIndex of a database into memory.

Parameters
[in]rSchemaInterfaceThe schema interface represents the database.
Returns
A return value < 0 indicates an error.

◆ _reindexObjStrIndexes()

int glo::RealIndexPool::_reindexObjStrIndexes ( const SchemaInterface & rSchemaInterface)
protected

Reindexes all objects of type ObjectStrIndex of a database into memory.

Parameters
[in]rSchemaInterfaceThe schema interface represents the database.
Returns
A return value < 0 indicates an error.

◆ _writeObjIDIndexes() [1/2]

int glo::RealIndexPool::_writeObjIDIndexes ( const SchemaIndex & rSchemaIndex) const
protected

Writes all objects of type TableObjIdIndex of a database from memory to the file system (ODX and FDX files)

Parameters
[in]rSchemaIndexThe schema index whose XX is to be written.
Returns
A return value < 0 indicates an error.

◆ _writeObjIDIndexes() [2/2]

int glo::RealIndexPool::_writeObjIDIndexes ( const SchemaInterface & rSchemaInterface) const
protected

Writes all objects of type TableObjIdIndex of a database from memory to the file system (ODX and FDX files)

Parameters
[in]rSchemaInterfaceThe schema interface represents the database.
Returns
A return value < 0 indicates an error.

◆ _writeObjStrIndexes() [1/2]

int glo::RealIndexPool::_writeObjStrIndexes ( const SchemaIndex & rSchemaIndex) const
protected

Writes all objects of type ObjectStrIndex of a database from memory to the file system (SDX files)

Parameters
[in]rSchemaIndexThe schema index whose XX is to be written.
Returns
A return value < 0 indicates an error.

◆ _writeObjStrIndexes() [2/2]

int glo::RealIndexPool::_writeObjStrIndexes ( const SchemaInterface & rSchemaInterface) const
protected

Writes all objects of type ObjectStrIndex of a database from memory to the file system (SDX files)

Parameters
[in]rSchemaInterfaceThe schema interface represents the database.
Returns
A return value < 0 indicates an error.

◆ existsSchemaIndex()

virtual bool glo::RealIndexPool::existsSchemaIndex ( const std::string & rsSchemaName) const
virtual

Checks if a SchemaIndex with the passed name exists.

Parameters
[in]rsSchemaNameThe schema name (e.g. "MyGloBase") of the schemaIndex to be checked.
Returns
Returns true, if a SchemaIndex with the passed name exists.
Note
This method locks further calls of methods of this class, which are protected with m_LocalCriticalSection.

◆ getFreeObjIDPos()

virtual int glo::RealIndexPool::getFreeObjIDPos ( std::streampos & rPos,
const std::string & rsSchemaName,
unsigned long ulClassID ) const
virtual

Returns a free table position in a TableObjIdIndex with passed class ID in a SchemaIndex.

Parameters
[in,out]rPosThe free table position, if one was available.
[in]rsSchemaNameThe schema name (e.g. "MyGloBase") to identify the SchemaIndex.
[in]ulClassIDThe class ID to identify the TableObjIdIndex.
Returns
A return value < 0 indicates an error.
Note
This method blocks further calls of methods of this class, which are secured with m_LocalCriticalSection.

◆ getNumberOfClassInfos()

std::size_t glo::RealIndexPool::getNumberOfClassInfos ( const SchemaInterface & rSchemaInterface) const

Returns the number of class information of the passed schema. Is used here to determine the number of ObjectID indexing actions. Two ObjID indexes (real and released) are maintained for each class information.

Parameters
[in]rSchemaInterfaceThe schema interface represents the database.
Returns
The number of class information of the passed schema.

◆ getNumberOfIndexes()

std::size_t glo::RealIndexPool::getNumberOfIndexes ( const SchemaInterface & rSchemaInterface) const

Returns the number of string indexes of all classes of the passed schema that can be indexed.

Parameters
[in]rSchemaInterfaceThe schema interface represents the database.
Returns
The number of string indexes of all classes of the given schema.

◆ insertFreeObjIDPos()

virtual int glo::RealIndexPool::insertFreeObjIDPos ( const std::string & rsSchemaName,
unsigned long ulClassID,
std::streampos Pos )
virtual

Registers a free table position in a TableObjIdIndex with passed class ID in a SchemaIndex.

Parameters
[in]rsSchemaNameThe schema name (e.g. "MyGloBase") to identify the SchemaIndex.
[in]ulClassIDThe class ID to identify the TableObjIdIndex.
[in]PosThe table position to be registered as 'free'.
Returns
A return value < 0 indicates an error.
Note
This method blocks further calls of methods of this class, which are secured with m_LocalCriticalSection.

◆ notifyIndexReadWrite()

void glo::RealIndexPool::notifyIndexReadWrite ( TdWatchNotifyMode iMode,
const std::string & rsSchemaName,
const ObjID & rObjID,
int iFraction,
int iActions )

Generates a notification request and passes it to the referenced WatchNotifyManager in m_pWatchNotifyManager.

Parameters
[in]iModeThe watch mode.
[in]rsSchemaNameThe schema name for the WatchNotifyManager::NotifyIndexReadWriteInfo::m_sSchemaName.
[in]rObjIDThe object ID for the WatchNotifyManager::NotifyIndexReadWriteInfo::m_ObjID.
[in]iFractionThe progress.
[in]iActionsThe expected number of actions.

◆ operator=()

RealIndexPool & glo::RealIndexPool::operator= ( const RealIndexPool & rT)

Assignment operator.

Parameters
[in]rTThe data is transferred from this object.

◆ readIndexes()

int glo::RealIndexPool::readIndexes ( const SchemaInterface & rSchemaInterface)

Reads all indexes of a database from the index files.

Parameters
[in]rSchemaInterfaceThe schema interface represents the database.
Returns
A return value < 0 indicates an error.
Note
This method locks further calls of methods of this class, which are protected with m_LocalCriticalSection.

◆ reindex() [1/2]

int glo::RealIndexPool::reindex ( const SchemaInterface & rSchemaInterface)

Reindexes all indexes of a database into memory.

Parameters
[in]rSchemaInterfaceThe schema interface represents the database.
Returns
A return value < 0 indicates an error.
Note
This method locks further calls of methods of this class, which are protected with m_LocalCriticalSection.

◆ reindex() [2/2]

int glo::RealIndexPool::reindex ( const SchemaInterface & rSchemaInterface,
int iActions )

Reindexes all indexes of a database into memory.

Parameters
[in]rSchemaInterfaceThe schema interface represents the database.
[in]iActionsIf passed, this value is used as the total action number for Notify.
Returns
A return value < 0 indicates an error.
Note
This method locks further calls of methods of this class, which are protected with m_LocalCriticalSection.

◆ reindexObjIDIndexes()

int glo::RealIndexPool::reindexObjIDIndexes ( const SchemaInterface & rSchemaInterface)

Reindexes all objects of type TableObjIdIndex of a database into memory.

Parameters
[in]rSchemaInterfaceThe schema interface represents the database.
Returns
A return value < 0 indicates an error.
Note
This method locks further calls of methods of this class, which are protected with m_LocalCriticalSection.

◆ reindexObjStrIndexes()

int glo::RealIndexPool::reindexObjStrIndexes ( const SchemaInterface & rSchemaInterface)

Reindexes all objects of type ObjectStrIndex of a database into memory.

Parameters
[in]rSchemaInterfaceThe schema interface represents the database.
Returns
A return value < 0 indicates an error.
Note
This method locks further calls of methods of this class, which are protected with m_LocalCriticalSection.

◆ removeFreeObjIDPos()

virtual int glo::RealIndexPool::removeFreeObjIDPos ( const std::string & rsSchemaName,
unsigned long ulClassID,
std::streampos Pos )
virtual

Removes a free table position in a TableObjIdIndex with passed class ID in a SchemaIndex.

Parameters
[in]rsSchemaNameThe schema name (e.g. "MyGloBase") to identify the SchemaIndex.
[in]ulClassIDThe class ID to identify the TableObjIdIndex.
[in]PosThe remote table position.
Returns
A return value < 0 indicates an error.
Note
This method blocks further calls of methods of this class, which are secured with m_LocalCriticalSection.

◆ removeSchemaIndex()

int glo::RealIndexPool::removeSchemaIndex ( const std::string & rsSchemaName)

Removes a SchemaIndex.

Parameters
[in]rsSchemaNameThe schema name (e.g. "MyGloBase") of the schema index to be removed.
Returns
A return value < 0 indicates an error.
Note
This method locks further calls of methods of this class, which are protected with m_LocalCriticalSection.

◆ setWatchNotifyManager()

void glo::RealIndexPool::setWatchNotifyManager ( WatchNotifyManager * pWatchNotifyManager)

Sets the m_pWatchNotifyManager. The calling instance must not delete the passed WatchNotifyManager before this object. If necessary, the calling instance must set m_pWatchNotifyManager to nullptr via this method.

Parameters
[in]pWatchNotifyManagerThe WatchNotifyManager to be referenced.

◆ writeIndexes() [1/2]

int glo::RealIndexPool::writeIndexes ( const SchemaInterface & rSchemaInterface)

Writes all indexes of a database from memory to the file system (ODX, FDX and SDX files)

Parameters
[in]rSchemaInterfaceThe schema interface represents the database.
Returns
A return value < 0 indicates an error.
Note
This method locks further calls of methods of this class, which are protected with m_LocalCriticalSection.

◆ writeIndexes() [2/2]

int glo::RealIndexPool::writeIndexes ( const SchemaInterface & rSchemaInterface,
int iActions )

Writes all indexes of a database from memory to the file system (ODX, FDX and SDX files)

Parameters
[in]rSchemaInterfaceThe schema interface represents the database.
[in]iActionsIf passed, this value is used as the total action number for Notify.
Returns
A return value < 0 indicates an error.
Note
This method locks further calls of methods of this class, which are protected with m_LocalCriticalSection.

◆ writeObjIDIndexes()

int glo::RealIndexPool::writeObjIDIndexes ( const SchemaInterface & rSchemaInterface) const

Writes all objects of type TableObjIdIndex of a database from memory to the file system (ODX and FDX files)

Parameters
[in]rSchemaInterfaceThe schema interface represents the database.
Returns
A return value < 0 indicates an error.
Note
This method locks further calls of methods of this class, which are protected with m_LocalCriticalSection.

◆ writeObjStrIndexes()

int glo::RealIndexPool::writeObjStrIndexes ( const SchemaInterface & rSchemaInterface) const

Writes all objects of type ObjectStrIndex of a database from memory to the file system (SDX files)

Parameters
[in]rSchemaInterfaceThe schema interface represents the database.
Returns
A return value < 0 indicates an error.
Note
This method locks further calls of methods of this class, which are protected with m_LocalCriticalSection.

Member Data Documentation

◆ m_iActions

int glo::RealIndexPool::m_iActions
private

When an action to be notified by the m_pWatchNotifyManager is executed, the expected overall actions are entered here.

◆ m_pWatchNotifyManager

WatchNotifyManager* glo::RealIndexPool::m_pWatchNotifyManager
private

If available, it is used to inform clients about index actions. Is managed by the calling instance!


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