GlobalObjects
|
IndexPool is the base class for the RealIndexPool and the TransactionIndexPool for the individual transactions. More...
#include <GloIndexPool.h>
Classes | |
class | DeletedObjIdTuple |
Class to manage deleted objects in the IndexPool::SchemaIndex. More... | |
struct | IndexComparisionFilter |
Filters can be assigned to objects of the type ObjectStrIndexIterator, which control the iteration by an ObjectStrIndex. With this structure, a filter can be defined using "<", "<=", ">", ">=", "==" and "!=". For example, if m_sIndexFilterValue has the value "123" and m_eComparisionOperator has the value GREATER_EQUAL, only all objects with an index greater than or equal to "123" will be filtered out. More... | |
struct | IndexFilter |
Filters can be assigned to objects of the type ObjectStrIndexIterator, which control the iteration by an ObjectStrIndex. This filter has an index filter expression in m_sIndexFilterValue. More... | |
struct | IndexRangeFilter |
Filters can be assigned to objects of the type ObjectStrIndexIterator, which control the iteration by an ObjectStrIndex. With this structure a filter can be defined by means of a range specification. For example, if m_sIndexFilterValue has the value "123" and m_sIndexFilterEndValue has the value "155", all Objects with an index lower than "123" and higher than "155" will be filtered out. Thus, only all objects with an index greater than/equal to "123" and less than/equal to "155" will be delivered in case of a query. More... | |
class | ObjectStrIndex |
Manages the individual string indices of a class. If this is a unique index, the ObjStrIdTuple are in a map, otherwise in a MultiMap. Then indexes in a MultiMap can be inserted as reserved, this is taken into account when inserting further. More... | |
class | ObjectStrIndexIterator |
Has a pointer to an ObjectStrIndex and allows iteration through this index. Is instantiated e.g. for AllSets so that they can iterate independently through StringIndexes. More... | |
class | ObjIdPosTuple |
Class to manage objects in the IndexPool::TableObjIdIndex. More... | |
class | ObjStrIdTuple |
Class to manage objects in the IndexPool::ObjectStrIndex. More... | |
class | SchemaIndex |
Is the index manager class for a schema resp. a database. More... | |
class | TableObjIdIndex |
Manages the object IDs (used and released) with their position in the respective tables. More... | |
class | TableObjIdIndexIterator |
Has a pointer to a TableObjIdIndex and allows to iterate through this index. Is instantiated e.g. for AllSets so that they can iterate through indexes independently. More... | |
Public Member Functions | |
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 |
IndexPool & | operator= (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 | |
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) |
Protected Attributes | |
eut::CriticalSection | m_LocalCriticalSection |
std::map< std::string, SchemaIndex *, std::less< std::string > > | m_SchemaIndexMap |
IndexPool is the base class for the RealIndexPool and the TransactionIndexPool for the individual transactions.
To speed up the search for records in the tables, the object ID is indexed with the table position in a TableObjIdIndex. Additionally an index of table positions of deleted data records is maintained. These two indexes are loaded into a RealIndexPool when a database is opened and are saved again when it is closed.
The RealIndexPool is the index from the database, i.e. real. Changes in the database that affect any index are documented in the RealIndexPool.
When a transaction is started, a TransactionIndexPool is created as a copy of the RealIndexPool and is validly administered for the respective transaction.
This means:
If an object is inserted, changed or deleted in the transaction and the TableObjIdIndex is affected, the index is only changed in the TransactionIndexPool.
If outside of a transaction an object is changed or deleted, the respective TransactionIndexPool is adjusted in all transactions, if the object is NOT in the transaction.
If an object is inserted outside a transaction, the respective objects of type TransactionIndexPool are adjusted in all transactions.
When a client asks for an object, the system first checks whether the client is in a transaction. Then the TransactionIndexPool is asked there; otherwise the RealIndexPool.
Structure:
A SchemaIndex is built for each schema, which builds the index from the tables using the information from this schema.
Schematic structure:
glo::IndexPool::IndexPool | ( | ) |
Standard constructor.
glo::IndexPool::IndexPool | ( | const IndexPool & | rT | ) |
Copy constructor.
[in] | rT | The data is copied from this object. |
|
virtual |
Destructor.
|
protected |
Removes all objects from m_SchemaIndexMap and from memory
|
protectedvirtual |
Checks if a SchemaIndex with a specific name exists in the m_SchemaIndexMap.
[in] | rsSchemaName | The schema name (e.g. "MyGloBase") of the SchemaIndex to be checked. |
|
protectedvirtual |
Returns a free table position in a TableObjIdIndex with passed class ID in a SchemaIndex.
[in,out] | rPos | The free table position, if one was available. |
[in] | rsSchemaName | The schema name (e.g. "MyGloBase") to identify the SchemaIndex. |
[in] | ulClassID | The class ID to identify the TableObjIdIndex. |
|
protectedvirtual |
Returns an ObjectStrIndex of a specified class with a specified name from a specified SchemaIndex
[in,out] | prRetVal | The StringIndex, if available. |
[in] | rsSchemaName | The schema name (e.g. "MyGloBase") of the returning SchemaIndex. |
[in] | ulClassID | The class ID. |
[in] | rsIndexName | The index name. E.g., if "[MyClassName.Index.IDX_MyIndexName]" in the schema, then "IDX_MyIndexName". |
|
protectedvirtual |
Returns the ObjectStrIndexIterator of a specific ObjectStrIndex of a specific database.
[in,out] | prObjStrIterators | The IndexIterator, if available. |
[in] | rsSchemaName | The schema name (e.g. "MyGloBase") of the schemaIndex to be delivered. |
[in] | ulClassID | The class ID of the TableObjIdIndex. |
[in] | rsIndexName | The index name. E.g., if "[MyClassName.Index.IDX_MyIndexName]" in the schema, then "IDX_MyIndexName". |
|
protectedvirtual |
Returns an object ID with its table position from the TableObjIdIndex with passed class ID in a SchemaIndex with a specific object ID.
[in,out] | prRetVal | If present, a pointer to a copy of the object ID with the table position. |
[in] | rsSchemaName | The schema name (e.g. "MyGloBase") to identify the SchemaIndex. |
[in] | ulClassID | The class ID to identify the TableObjIdIndex. |
[in] | rObjID | The object ID of the entry to be delivered. |
|
protectedvirtual |
Returns a SchemaIndex with a specific name from the m_SchemaIndexMap.
[in,out] | prRetVal | The SchemaIndex, if available. |
[in] | rsSchemaName | The schema name (e.g. "MyGloBase") of the SchemaIndex to be returned. |
|
protectedvirtual |
Returns a TableObjIdIndex of a certain class from a certain SchemaIndex.
[in,out] | prRetVal | The index, if available. |
[in] | rsSchemaName | The schema name (e.g. "MyGloBase") of the returning SchemaIndex. |
[in] | ulClassID | The class ID. |
|
protectedvirtual |
Returns the TableObjIdIndexIterator of a specified TableObjIdIndex of a specified database.
[in,out] | prTableIterators | The IndexIterator, if present. |
[in] | rsSchemaName | The schema name (e.g. "MyGloBase") of the schemaIndex to be returned. |
[in] | ulClassID | The class ID of the TableObjIdIndex. |
|
protectedvirtual |
Registers the passed object ID for a SchemaIndex as deleted.
[in] | rsSchemaName | The schema name (e.g. "MyGloBase") to identify the SchemaIndex. |
[in] | rDeletedObjId | The object ID to register as deleted. |
|
protectedvirtual |
Registers a free table position in a TableObjIdIndex with passed class ID in a SchemaIndex.
[in] | rsSchemaName | The schema name (e.g. "MyGloBase") to identify the SchemaIndex. |
[in] | ulClassID | The class ID to identify the TableObjIdIndex. |
[in] | Pos | The table position to be registered as 'free'. |
|
protectedvirtual |
Inserts an object ID with the table position into a TableObjIdIndex in a SchemaIndex.
[in] | rsSchemaName | The schema name (e.g. "MyGloBase") to identify the SchemaIndex. |
[in] | ulClassID | The class ID to identify the TableObjIdIndex. |
[in] | rIndexTuple | The object ID to be inserted with the table position. |
|
protectedvirtual |
Inserts a StringIndex into an ObjectStrIndex in a SchemaIndex.
[in] | rsSchemaName | The schema name (e.g. "MyGloBase") around the SchemaIndex. |
[in] | ulClassID | The class ID to identify the ObjectStrIndex. identify. |
[in] | rsIndexName | The name of the ObjectStrIndex. If e.g. in Scheme "[MyClassName.Index.IDX_MyIndexName]", then "IDX_MyIndexName". |
[in] | rIndexTuple | The index to be inserted. |
|
protectedvirtual |
Checks if an object ID in a schema index is marked as deleted.
[in] | rsSchemaName | The schema name (e.g. "MyGloBase") to identify the SchemaIndex. |
[in] | rObjID | The object ID to be checked. |
|
protectedvirtual |
Checks an object ID whether it is already managed in a TableObjIdIndex in a SchemaIndex.
[in] | rsSchemaName | The schema name (e.g. "MyGloBase") to identify the SchemaIndex. |
[in] | ulClassID | The class ID to identify the TableObjIdIndex. |
[in] | rObjID | The object ID to be checked. |
|
protectedvirtual |
Generates an ObjectStrIndex with a name, for a class with a certain class ID for a certain schema index. If the SchemaIndex does not exist yet, it will be generated too.
[in] | rsSchemaName | The schema name (e.g. "MyGloBase"). |
[in] | rsTablePathName | The complete directory name necessary for the ObjectStrIndex in which the tables can be found, e.g. "C:/Path/Data/". |
[in] | ulClassID | The class ID of the managed indexes. |
[in] | rsIndexName | The index name. E.g., if "[MyClassName.Index.IDX_MyIndexName]" in the schema, then "IDX_MyIndexName". |
[in] | bUnique | If true, then this is a unique index (each entry can only exist once), otherwise several identical entries are possible. |
|
protectedvirtual |
Generates a TableObjIdIndex for a class with a certain class ID for a certain schema index. If the SchemaIndex does not exist yet, it will be generated too.
[in] | rsSchemaName | The schema name (e.g. "MyGloBase"). |
[in] | rsTablePathName | The complete directory name necessary for the TableObjIdIndex in which the tables can be found, e.g. "C:/Path/Data/". |
[in] | ulClassID | The class ID of the managed indexes. |
|
protectedvirtual |
Removes a free table position in a TableObjIdIndex with passed class ID in a SchemaIndex.
[in] | rsSchemaName | The schema name (e.g. "MyGloBase") to identify the SchemaIndex. |
[in] | ulClassID | The class ID to identify the TableObjIdIndex. |
[in] | Pos | The remote table position. |
|
protected |
Removes the SchemaIndex with passed schema name from m_SchemaIndexMap.
[in] | rsSchemaName | The schema name (e.g. "MyGloBase") of the schema index to be removed. |
|
protected |
Removes all objects from m_SchemaIndexMap and from memory. Then all elements of the same list of the passed IndexPool are copied.
Is used by the operator=.
[in] | rT | The IndexPool whose indexes are to be copied. |
void glo::IndexPool::deleteAllSchemaIndexValues | ( | ) |
Removes all objects from m_SchemaIndexMap and from memory
|
virtual |
Returns the ObjectStrIndexIterator of a specific ObjectStrIndex of a specific database.
[in,out] | prObjectStrIndexIterators | The iterator, if available. |
[in] | rsSchemaName | The schema name (e.g. "MyGloBase") of the schemaIndex to be returned. |
[in] | ulClassID | The class ID of the TableObjIdIndex. |
[in] | rsIndexName | The name of the index to be checked. E.g., if "[MyClassName.Index.IDX_MyIndexName]" in the schema, then "IDX_MyIndexName". |
|
virtual |
Returns an object ID with its table position from the TableObjIdIndex with passed class ID in a SchemaIndex with a specific object ID.
[in,out] | prRetVal | If present, a pointer to a copy of the object ID with the table position. |
[in] | rsSchemaName | The schema name (e.g. "MyGloBase") to identify the SchemaIndex. |
[in] | ulClassID | The class ID to identify the TableObjIdIndex. |
[in] | rObjID | The object ID of the entry to be delivered. |
|
virtual |
Returns the TableObjIdIndexIterator of a specified TableObjIdIndex of a specified database.
[in,out] | prTableIterators | The iterator, if present. |
[in] | rsSchemaName | The schema name (e.g. "MyGloBase") of the schemaIndex to be returned. |
[in] | ulClassID | The class ID of the TableObjIdIndex. |
|
virtual |
Registers the passed object ID for a SchemaIndex as deleted.
[in] | rsSchemaName | The schema name (e.g. "MyGloBase") to identify the SchemaIndex. |
[in] | rDeletedObjId | The object ID to register as deleted. |
|
virtual |
Inserts an object ID with the table position into a TableObjIdIndex in a SchemaIndex.
[in] | rsSchemaName | The schema name (e.g. "MyGloBase") to identify the SchemaIndex. |
[in] | ulClassID | The class ID to identify the TableObjIdIndex. |
[in] | rIndexTuple | The object ID to be inserted with the table position. |
|
virtual |
Inserts a StringIndex into an ObjectStrIndex in a SchemaIndex.
[in] | rsSchemaName | The schema name (e.g. "MyGloBase") around the SchemaIndex. |
[in] | ulClassID | The class ID to identify the ObjectStrIndex. identify. |
[in] | rsIndexName | The name of the ObjectStrIndex. If e.g. in Scheme "[MyClassName.Index.IDX_MyIndexName]", then "IDX_MyIndexName". |
[in] | rIndexTuple | The index to be inserted. |
|
virtual |
Checks if an IndexString is still free for a certain ObjectStrIndex in a SchemaIndex.
[in] | rsSchemaName | The schema name (e.g. "MyGloBase") to identify the SchemaIndex. |
[in] | ulClassID | The class ID to identify the ObjectStrIndex. |
[in] | rObjID | The object ID to identify the ObjectStrIndex. |
[in] | rsIndexName | The name of the index to be checked. For example, if in the schema "[MyClassName.Index.IDX_MyIndexName]", then "IDX_MyIndexName". |
[in] | rsIndex | The index to be checked. |
|
virtual |
Checks if an object ID in a schema index is marked as deleted.
[in] | rsSchemaName | The schema name (e.g. "MyGloBase") to identify the SchemaIndex. |
[in] | rObjID | The object ID to be checked. |
|
virtual |
Checks an object ID whether it is already managed in a TableObjIdIndex in a SchemaIndex.
[in] | rsSchemaName | The schema name (e.g. "MyGloBase") to identify the SchemaIndex. |
[in] | rObjID | The object ID to be checked. |
Assignment operator.
[in] | rT | The data is transferred from this object. |
int glo::IndexPool::releaseAllCommunicatorObjStrIdTuples | ( | const std::string & | rsSchemaName, |
const NUM_PTR | ipReservingComunicator ) |
Releases all unique string indexes in an ObjectStrIndex in a SchemaIndex that were rereserved by the passed communicator.
[in] | rsSchemaName | The schema name (e.g. "MyGloBase") to identify the SchemaIndex. |
[in] | ipReservingComunicator | The address of the communicator that reserved the index, cast to NUM_PTR. |
eut::ErrorNException | If ipReservingComunicator == 0, an exception is thrown. |
int glo::IndexPool::releaseObjStrIdTuple | ( | const std::string & | rsSchemaName, |
unsigned long | ulClassID, | ||
const std::string & | rsIndexName, | ||
const NUM_PTR | ipReservingComunicatorTrx ) |
Releases a StringIndex into an ObjectStrIndex in a SchemaIndex if it is a unique index.
[in] | rsSchemaName | The schema name (e.g. "MyGloBase") to identify the SchemaIndex. |
[in] | ulClassID | The class ID to identify the ObjectStrIndex. |
[in] | rsIndexName | The name of the ObjectStrIndex. For example, if in the schema "[MyClassName.Index.IDX_MyIndexName]", then "IDX_MyIndexName". |
[in] | ipReservingComunicatorTrx | The transaction step for which the reservation was requested. |
eut::ErrorNException | If ipReservingComunicatorTrx == 0, an exception is thrown. |
|
virtual |
Removes the entry with passed object ID from the TableObjIdIndex with passed class ID in a SchemaIndex.
[in] | rsSchemaName | The schema name (e.g. "MyGloBase") to identify the SchemaIndex. |
[in] | ulClassID | The class ID to identify the TableObjIdIndex. |
[in] | rObjID | The object ID to be removed. |
|
virtual |
Removes string index of an object with passed name from the ObjectStrIndex with passed class ID in a SchemaIndex
[in] | rsSchemaName | The schema name (e.g. "MyGloBase") to identify the SchemaIndex. |
[in] | ulClassID | The class ID to identify the ObjectStrIndex. |
[in] | rsIndexName | The name of the ObjectStrIndex. For example, if in the schema "[MyClassName.Index.IDX_MyIndexName]", then "IDX_MyIndexName". |
[in] | rObjID | The object ID of the index to be removed. |
[in] | ipReservingComunicatorTrx | The address, casted to NUM_PTR, of a Communicator in whose transaction the index was reserved, if applicable. If this is set, only a reserved index is deleted. |
int glo::IndexPool::reserveObjStrIdTuple | ( | const std::string & | rsSchemaName, |
unsigned long | ulClassID, | ||
const std::string & | rsIndexName, | ||
const ObjStrIdTuple & | rIndexTuple ) |
Reserves a StringIndex into an ObjectStrIndex in a SchemaIndex if it is a unique index.
[in] | rsSchemaName | The schema name (e.g. "MyGloBase") to identify the SchemaIndex. |
[in] | ulClassID | The class ID to identify the ObjectStrIndex. |
[in] | rsIndexName | The name of the ObjectStrIndex. For example, if in the schema "[MyClassName.Index.IDX_MyIndexName]", then "IDX_MyIndexName". |
[in] | rIndexTuple | The index to be reserved. |
eut::ErrorNException | If ObjStrIdTuple::m_ipReservingComunicatorTrx is not set in the parameter rIndexTuple, an exception is thrown. |
|
protected |
To ensure thread-safe access to the elements of the IndexPool and subclasses, access is synchronized via this local CriticalSection.
|
protected |
For each open database there is a SchemaIndex.