GlobalObjects
|
Is the index manager class for a schema resp. a database. More...
#include <GloIndexPool.h>
Public Member Functions | |
SchemaIndex (const SchemaIndex &rT) | |
SchemaIndex (const std::string &rstrName) | |
~SchemaIndex () | |
int | getFreeObjIDPos (std::streampos &rPos, unsigned long ulClassID) const |
int | getObjectStrIndex (ObjectStrIndex *&prRetVal, unsigned long ulClassID, const std::string &rsIndexName) |
int | getObjectStrIndexIterator (ObjectStrIndexIterator *&prObjectStrIndexIterators, unsigned long ulClassID, const std::string &rsIndexName) const |
const std::multimap< unsigned long, IndexPool::ObjectStrIndex *, std::less< unsigned long > > & | getObjectStrIndexMapRef () const |
int | getObjIdPosTuple (ObjIdPosTuple *&prRetVal, unsigned long ulClassID, const ObjID &rObjID) const |
std::string | getSchemaName () const |
int | getTableObjIdIndex (TableObjIdIndex *&prRetVal, unsigned long ulClassID) const |
int | getTableObjIdIndexIterator (TableObjIdIndexIterator *&prTableIterators, unsigned long ulClassID) const |
const std::map< unsigned long, IndexPool::TableObjIdIndex *, std::less< unsigned long > > & | getTableObjIdIndexMapRef () const |
int | insertDeletedObjID (const ObjID &rDeletedObjId) |
int | insertFreeObjIDPos (unsigned long ulClassID, std::streampos Pos) |
int | insertObjIdPosTuple (unsigned long ulClassID, const ObjIdPosTuple &rIndexTuple) |
int | insertObjStrIdTuple (unsigned long ulClassID, const std::string &rsIndexName, const ObjStrIdTuple &rIndexTuple) |
int | insertTransactionDeletedObjID (const ObjID &rDeletedObjId) |
int | isIndexFree (unsigned long ulClassID, const ObjID &rObjID, const std::string &rsIndexName, const std::string &rsIndex) const |
bool | isObjIdDeleted (const ObjID &rObjID) const |
int | isObjIdFree (unsigned long ulClassID, const ObjID &rObjID) const |
int | makeObjectStrIndex (const std::string &rsPathName, unsigned long ulClassID, const std::string &rsIndexName, bool bUnique) |
int | makeTableObjIdIndex (const std::string &rsPathName, unsigned long ulClassID) |
IndexPool::SchemaIndex & | operator= (const SchemaIndex &rT) |
int | releaseObjStrIdTuple (unsigned long ulClassID, const std::string &rsIndexName, const NUM_PTR ipReservingComunicatorTrx) |
int | removeFreeObjIDPos (unsigned long ulClassID, std::streampos Pos) |
int | removeObjectStrIndex (unsigned long ulClassID, const std::string &rsIndexName) |
int | removeObjId (unsigned long ulClassID, const ObjID &rObjID) |
int | removeObjStrIdTuple (unsigned long ulClassID, const std::string &rsIndexName, const ObjID &rObjID, NUM_PTR ipReservingComunicatorTrx=0) |
int | removeTableObjIdIndex (unsigned long ulClassID) |
int | removeTransactionDeletedObjID (const ObjID &rDeletedObjId) |
int | reserveObjStrIdTuple (unsigned long ulClassID, const std::string &rsIndexName, const ObjStrIdTuple &rIndexTuple) |
Protected Member Functions | |
SchemaIndex () | |
void | copyMapsFrom (const SchemaIndex &rT) |
void | deleteAllTableIndexValues () |
Private Attributes | |
std::map< ObjID, ObjID *, std::less< ObjID > > | m_DeletedObjIdMap |
std::multimap< unsigned long, ObjectStrIndex *, std::less< unsigned long > > | m_ObjectStrIndexMap |
std::string | m_sSchemaName |
std::map< unsigned long, TableObjIdIndex *, std::less< unsigned long > > | m_TableObjIdIndexMap |
std::map< ObjID, DeletedObjIdTuple *, std::less< ObjID > > | m_TransactionDeletedObjIdMap |
Is the index manager class for a schema resp. a database.
|
protected |
The default constructor is not available.
glo::IndexPool::SchemaIndex::SchemaIndex | ( | const std::string & | rstrName | ) |
Constructor with parameter passing.
[in] | rstrName | The schema name (e.g. "MyGloBase"). |
glo::IndexPool::SchemaIndex::SchemaIndex | ( | const SchemaIndex & | rT | ) |
Copy constructor.
[in] | rT | The data is copied from this object. |
eut::ErrorNException | An exception is thrown if an error occurs. |
glo::IndexPool::SchemaIndex::~SchemaIndex | ( | ) |
Destructor.
|
protected |
Removes all elements from its maps. Then all elements of the same maps of the passed SchemaIndex are copied.
[in] | rT | The SchemaIndex whose elements are to be copied from the maps. |
|
protected |
Removes all elements from its maps and from memory.
int glo::IndexPool::SchemaIndex::getFreeObjIDPos | ( | std::streampos & | rPos, |
unsigned long | ulClassID ) const |
Returns a free table position in a table.
[in,out] | rPos | The free table position, if one exists. |
[in] | ulClassID | The class ID to identify the TableObjIdIndex. |
int glo::IndexPool::SchemaIndex::getObjectStrIndex | ( | ObjectStrIndex *& | prRetVal, |
unsigned long | ulClassID, | ||
const std::string & | rsIndexName ) |
Returns an ObjectStrIndex of a specific class with a specific name.
[in,out] | prRetVal | The ObjectStrIndex, if available. |
[in] | ulClassID | The class ID. |
[in] | rsIndexName | The index name. E.g., if "[MyClassName.Index.IDX_MyIndexName]" in the schema, then "IDX_MyIndexName". |
int glo::IndexPool::SchemaIndex::getObjectStrIndexIterator | ( | ObjectStrIndexIterator *& | prObjectStrIndexIterators, |
unsigned long | ulClassID, | ||
const std::string & | rsIndexName ) const |
Returns an iterator on a TableObjIdIndex of a certain class.
[in,out] | prObjectStrIndexIterators | The iterator. |
[in] | ulClassID | The class ID. |
[in] | rsIndexName | The index name. For example, if "[MyClassName.Index.IDX_MyIndexName]" is indexed in the schema, then "IDX_MyIndexName". |
const std::multimap< unsigned long, IndexPool::ObjectStrIndex *, std::less< unsigned long > > & glo::IndexPool::SchemaIndex::getObjectStrIndexMapRef | ( | ) | const |
Returns a reference to m_ObjectStrIndexMap.
int glo::IndexPool::SchemaIndex::getObjIdPosTuple | ( | ObjIdPosTuple *& | prRetVal, |
unsigned long | ulClassID, | ||
const ObjID & | rObjID ) const |
Returns an ObjIdPosTuple with the passed object ID.
[in,out] | prRetVal | If present, a pointer to a copy of the object ID with the table position. |
[in] | ulClassID | The class ID to identify the TableObjIdIndex. |
[in] | rObjID | The object ID of the entry to be returned. |
std::string glo::IndexPool::SchemaIndex::getSchemaName | ( | ) | const |
Returns the schema name.
int glo::IndexPool::SchemaIndex::getTableObjIdIndex | ( | TableObjIdIndex *& | prRetVal, |
unsigned long | ulClassID ) const |
Returns a TableObjIdIndex of a certain class.
[in,out] | prRetVal | The TableObjIdIndex, if available. |
[in] | ulClassID | The class ID. |
int glo::IndexPool::SchemaIndex::getTableObjIdIndexIterator | ( | TableObjIdIndexIterator *& | prTableIterators, |
unsigned long | ulClassID ) const |
Returns an iterator on a TableObjIdIndex of a certain class.
[in,out] | prTableIterators | The iterator. |
[in] | ulClassID | The class ID. |
const std::map< unsigned long, IndexPool::TableObjIdIndex *, std::less< unsigned long > > & glo::IndexPool::SchemaIndex::getTableObjIdIndexMapRef | ( | ) | const |
Returns a reference to m_TableObjIdIndexMap.
int glo::IndexPool::SchemaIndex::insertDeletedObjID | ( | const ObjID & | rDeletedObjId | ) |
Registers the passed object ID for this database as deleted.
[in] | rDeletedObjId | The object ID to register as deleted. |
int glo::IndexPool::SchemaIndex::insertFreeObjIDPos | ( | unsigned long | ulClassID, |
std::streampos | Pos ) |
Registriert eine freie Tabellen-Position in einer Tabelle.
[in] | ulClassID | Die Klassen-ID, um den TableObjIdIndex zu identifizieren. |
[in] | Pos | Die als 'frei' zu registrierende Tabellen-Position. |
int glo::IndexPool::SchemaIndex::insertObjIdPosTuple | ( | unsigned long | ulClassID, |
const ObjIdPosTuple & | rIndexTuple ) |
Inserts an object ID with the table position, where the corresponding data set is stored, into the TableObjIdIndex with passed class ID.
[in] | ulClassID | The class ID to identify the TableObjIdIndex. |
[in] | rIndexTuple | The object ID to be inserted with the table position. |
int glo::IndexPool::SchemaIndex::insertObjStrIdTuple | ( | unsigned long | ulClassID, |
const std::string & | rsIndexName, | ||
const ObjStrIdTuple & | rIndexTuple ) |
Inserts a StringIndex into an ObjectStrIndex.
[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 StringIndex to be inserted. |
int glo::IndexPool::SchemaIndex::insertTransactionDeletedObjID | ( | const ObjID & | rDeletedObjId | ) |
Registered Pass object ID for the current transaction as deleted (increments the deletion counter, see also DeletedObjIdTuple::m_iDelCounter.
[in] | rDeletedObjId | The object ID to register as deleted. |
int glo::IndexPool::SchemaIndex::isIndexFree | ( | unsigned long | ulClassID, |
const ObjID & | rObjID, | ||
const std::string & | rsIndexName, | ||
const std::string & | rsIndex ) const |
Checks if an index string is still free.
[in] | ulClassID | The class ID to identify the ObjectStrIndex. |
[in] | rObjID | The object ID to identify the item. |
[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. |
bool glo::IndexPool::SchemaIndex::isObjIdDeleted | ( | const ObjID & | rObjID | ) | const |
Checks whether an object ID is marked as deleted. Looks not only in the m_DeletedObjIdMap but also in the m_TransactionDeletedObjIdMap.
[in] | rObjID | The object ID to be checked. |
int glo::IndexPool::SchemaIndex::isObjIdFree | ( | unsigned long | ulClassID, |
const ObjID & | rObjID ) const |
Checks an object ID whether it is already managed.
[in] | ulClassID | The class ID to identify the TableObjIdIndex. |
[in] | rObjID | The object ID to be checked. |
int glo::IndexPool::SchemaIndex::makeObjectStrIndex | ( | const std::string & | rsPathName, |
unsigned long | ulClassID, | ||
const std::string & | rsIndexName, | ||
bool | bUnique ) |
Inserts a new ObjectStrIndex into its m_ObjectStrIndexMap.
[in] | rsPathName | The complete directory name where the tables can be found like "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. |
int glo::IndexPool::SchemaIndex::makeTableObjIdIndex | ( | const std::string & | rsPathName, |
unsigned long | ulClassID ) |
Inserts a new TableObjIdIndex into its m_TableObjIdIndexMap.
[in] | rsPathName | The complete directory name where the tables are located, e.g. "C:/Path/Data/". |
[in] | ulClassID | The class ID of the managed indexes. |
IndexPool::SchemaIndex & glo::IndexPool::SchemaIndex::operator= | ( | const SchemaIndex & | rT | ) |
Assignment operator.
[in] | rT | The data is transferred from this object. |
int glo::IndexPool::SchemaIndex::releaseObjStrIdTuple | ( | unsigned long | ulClassID, |
const std::string & | rsIndexName, | ||
const NUM_PTR | ipReservingComunicatorTrx ) |
Releases a StringIndex into an ObjectStrIndex if it is a unique index.
[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 ulReservingComunicatorTrx == 0, an exception is thrown. |
int glo::IndexPool::SchemaIndex::removeFreeObjIDPos | ( | unsigned long | ulClassID, |
std::streampos | Pos ) |
Removes a free table position from the TableObjIdIndex with corresponding to the passed class ID.
[in] | ulClassID | The class ID to identify the TableObjIdIndex. |
[in] | Pos | The table position to be removed. |
int glo::IndexPool::SchemaIndex::removeObjectStrIndex | ( | unsigned long | ulClassID, |
const std::string & | rsIndexName ) |
Deletes the ObjectStrIndex with passed ClassID and the passed name, if available, from m_ObjectStrIndexMap and from memory.
[in] | ulClassID | The class ID of the index to be removed. |
[in] | rsIndexName | The name of the index to be removed. E.g., if "[MyClassName.Index.IDX_MyIndexName]" in the schema, then "IDX_MyIndexName". |
int glo::IndexPool::SchemaIndex::removeObjId | ( | unsigned long | ulClassID, |
const ObjID & | rObjID ) |
Removes the item with passed object ID from the map, which managed the stored object IDs and table position, from the TableObjIdIndex with passed class ID.
[in] | ulClassID | The class ID to identify the TableObjIdIndex. |
[in] | rObjID | The object ID to be removed. |
int glo::IndexPool::SchemaIndex::removeObjStrIdTuple | ( | unsigned long | ulClassID, |
const std::string & | rsIndexName, | ||
const ObjID & | rObjID, | ||
NUM_PTR | ipReservingComunicatorTrx = 0 ) |
Removes the string index from the map or MultiMap of the Indiezes of an ObjectStrIndex.
[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::SchemaIndex::removeTableObjIdIndex | ( | unsigned long | ulClassID | ) |
Deletes the TableObjIdIndex with passed ClassID, if available from its m_TableObjIdIndexMap and from memory.
[in] | ulClassID | The class ID of the index to be removed. |
int glo::IndexPool::SchemaIndex::removeTransactionDeletedObjID | ( | const ObjID & | rDeletedObjId | ) |
Deregistered passed object ID for the current transaction as deleted. The deleted object ID with the highest deletion counter is searched for and removed (decrements the deletion counter, see also DeletedObjIdTuple::m_iDelCounter).
[in] | rDeletedObjId | The object ID to be deregistered as deleted. |
int glo::IndexPool::SchemaIndex::reserveObjStrIdTuple | ( | unsigned long | ulClassID, |
const std::string & | rsIndexName, | ||
const ObjStrIdTuple & | rIndexTuple ) |
Reserves a StringIndex into an ObjectStrIndex if it is a unique index.
[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. |
|
private |
The individual object IDs of the objects that have been deleted since the last time the indexes were loaded. These object IDs must not be saved anymore.
|
private |
The individual objects of type ObjectStrIndex for the classes of this schema resp. this database.
Index is the class ID.
|
private |
The schema name (e.g. "MyGloBase").
|
private |
The individual objects of type TableObjIdIndex for each class of this schema resp. database.
Index is the class ID.
|
private |
The individual object IDs of the objects that were deleted in a transaction. The object IDs are managed with a deletion counter.
This is necessary because deleting an object from the database multiple times does not constitute an error and if an object is deleted multiple times in a transaction and individual sub-transactions are cancelled, it must be ensured that the current deletion status is known from the deletion counter.