xflminterface IF_BTreeInfo : public XF_RefCount
This class contains methods for getting detailed information on how disk is being used inside indexes and collections in an XFLAIM database.
Method Summary |
|
void |
clearBTreeInfo - Clear information gathered in the IF_BTreeInfo object. |
RCODE |
collectIndexInfo - Collect information about indexes in a database. |
RCODE |
collectCollectionInfo - Collect information about collections in a database. |
FLMUINT |
getNumIndexes - Returns the number of indexes for which information has been collected. |
FLMUINT |
getNumCollections - Returns the number of collections for which information has been collected. |
FLMBOOL |
getIndexInfo - Returns information about the nth index for which information has been collected. |
FLMBOOL |
getCollectionInfo - Returns information about the nth collection for which information has been collected. |
FLMBOOL |
getIndexLevelInfo - Returns information about a specific level in an index's b-tree. |
FLMBOOL |
getCollectionLevelInfo - Returns information about a specific level in a collection's b-tree. |
Method Detail |
void clearBTreeInfo( void)
This is a method clears all of the information that has been gathered in the object. This allows the object to be reused over and over for different information gathering needs.
Parameters In: none
Parameters Out: none
Example Code:
RCODE rc;
IF_BTreeInfo * pBTreeInfo = NULL;
IF_Db * pDb = NULL;
APP_BTreeInfoStatus AppBTreeInfoStatus; // This is the application's implementation of the IF_BTreeStatusInfo interface
FLMUINT uiNumIndexes;
FLMUINT uiNumCollections;
FLMUINT uiLoop;
FLMUINT uiNumLevels;
FLMUINT uiLevel;
char * pszName;
FLMUINT uiIndexNum;
FLMUINT uiCollectionNum;
XFLM_BTREE_LEVEL_INFO info;
if (RC_BAD( rc = pDbSystem->createIFBTreeInfo( &pBTreeInfo)))
{
printf( "Error %08X calling createIFNodeInfo\n", (unsigned)rc);
goto Exit;
}
// Open a database we want to gather information on
if (RC_BAD( rc = pDbSystem->dbOpen( "dib.db", NULL, NULL, &pDb, NULL, FALSE)))
{
printf( "Error %08X calling dbOpen\n", (unsigned)rc);
goto Exit;
}
// Collect information on all indexes in the database.
if (RC_BAD( rc = pBTreeInfo->collectIndexInfo( pDb, 0, &AppBTreeInfoStatus)))
{
printf( "Error %08X calling collectIndexInfo\n", (unsigned)rc);
goto Exit;
}
uiNumIndexes = pBTreeInfo->getNumIndexes();
// Print out the information on each index
for (uiLoop = 0; uiLoop < uiNumIndexes; uiLoop++)
{
if (pBTreeInfo->getIndexInfo( uiLoop, &uiIndexNum, &pszName, &uiNumLevels)))
{
// Print out information for each level of the B-tree
for (uiLevel = 0; uiLevel < uiNumLevels; uiLevel++)
{
if (pBTreeInfo->getIndexLevelInfo( uiLoop, uiLevel, &info))
{
// Print out fields in info structure.
printf( ....)
.
.
}
}
}
}
// Clear the information collected so far. NOTE: This is not really necessary, but it is here to illustrate how to make the call to
// clearBTreeInfo.
pBTreeInfo->clearBTreeInfo();
// Collection information on all collections in the database.
if (RC_BAD( rc = pBTreeInfo->collectCollectionInfo( pDb, 0, &AppBTreeInfoStatus)))
{
printf( "Error %08X calling collectCollectionInfo\n", (unsigned)rc);
goto Exit;
}
uiNumCollections = pBTreeInfo->getNumCollections();
// Print out the information on each collection
for (uiLoop = 0; uiLoop < uiNumCollections; uiLoop++)
{
if (pBTreeInfo->getCollectionInfo( uiLoop, &uiCollectionNum, &pszName, &uiNumLevels)))
{
// Print out information for each level of the B-tree
for (uiLevel = 0; uiLevel < uiNumLevels; uiLevel++)
{
if (pBTreeInfo->getCollectionLevelInfo( uiLoop, uiLevel, &info))
{
// Print out fields in info structure.
printf( ....)
.
.
}
}
}
}
Exit:
if (pBTreeInfo)
{
pBTree->Release();
}
if (pDb)
{
pDb->Release();
}
return( rc);
RCODE collectIndexInfo(
IF_Db * pDb,
FLMUINT uiIndexNum,
IF_BTreeInfoStatus * pBTreeInfoStatus);
This method collects information about an index or indexes and adds it to the information already collected.
Parameters In:
IF_Db * pDb Database containing the indexes we are collecting information on. FLMUINT uiIndexNum Number of index to collect information on. If zero, will collect information on all indexes in the database. IF_BTreeInfoStatus * pBTreeInfoStatus If non-NULL, this is a pointer to a status object that has an infoStatus method for reporting progress. collectIndexInfo will report progress by calling this object's infoStatus method. If the infoStatus method returns a non-zero return code, the information gathering will be canceled. It is up to the application to implement the IF_BTreeInfoStatusinterface.
Parameters Out: none
Example Code: see clearBTreeInfo
See Also: collectCollectionInfo
RCODE collectCollectionInfo(
IF_Db * pDb,
FLMUINT uiCollectionNum,
IF_BTreeInfoStatus * pBTreeInfoStatus);
This method collects information about a collection or collections and adds it to the information already collected.
Parameters In:
IF_Db * pDb Database containing the collections we are collecting information on. FLMUINT uiIndexNum Number of collection to collect information on. If zero, will collect information on all collections in the database. IF_BTreeInfoStatus * pBTreeInfoStatus If non-NULL, this is a pointer to a status object that has an infoStatus method for reporting progress. collectCollectionInfo will report progress by calling this object's infoStatus method. If the infoStatus method returns a non-zero return code, the information gathering will be canceled. It is up to the application to implement the IF_BTreeInfoStatusinterface.
Parameters Out: none
Example Code: see clearBTreeInfo
See Also: collectIndexInfo
FLMUINT getNumIndexes( void);
This method returns the number of indexes for which information has been collected.
Parameters In: none
Parameters Out: none
Example Code: see clearBTreeInfo
See Also: getNumCollections
FLMUINT getNumCollections( void);
This method returns the number of collections for which information has been collected.
Parameters In: none
Parameters Out: none
Example Code: see clearBTreeInfo
See Also: getNumIndexes
FLMBOOL getIndexInfo(
FLMUINT uiNthIndex,
FLMUINT * puiIndexNum,
char ** ppszIndexName,
FLMUINT * puiNumLevels);
This method returns information about the nth index in the list of indexes for which information has been collected. This method returns FALSE if the uiNthIndex is a number that is out of the range of the number of indexes for which information has been collected. If getNumIndexes reports that there is information for 12 indexes, uiNthIndex must be between 0 and 11 (it is zero-based). If it is not, this method will return FALSE.
Parameters In:
FLMUINT uiNthIndex This specifies which index in the list of indexes information is to be returned on. It is zero-based. Thus, if the getNumIndexes method returns 12, this should be a number between 0 and 11.
Parameters Out:
FLMUINT * puiIndexNum Index number is returned here. char ** ppszIndexName Pointer to index's name is returned here. FLMUINT * puiNumLevels Number of levels in the index's b-tree is returned here.
Example Code: see clearBTreeInfo
See Also: getCollectionInfo
FLMBOOL getCollectionInfo(
FLMUINT uiNthCollection,
FLMUINT * puiCollectionNum,
char ** ppszCollectionName,
FLMUINT * puiNumLevels);
This method returns information about the nth index in the list of indexes for which information has been collected. This method returns FALSE if the uiNthCollection is a number that is out of the range of the number of collections for which information has been collected. If getNumCollections reports that there is information for 12 collections, uiNthCollection must be between 0 and 11 (it is zero-based). If it is not, this method will return FALSE.
Parameters In:
FLMUINT uiNthCollection This specifies which collection in the list of collections information is to be returned on. It is zero-based. Thus, if the getNumCollections method returns 12, this should be a number between 0 and 11.
Parameters Out:
FLMUINT * puiCollectionNum Collection number is returned here. char ** ppszCollectionName Pointer to collections's name is returned here. FLMUINT * puiNumLevels Number of levels in the collection's b-tree is returned here.
Example Code: see clearBTreeInfo
See Also: getIndexInfo
FLMBOOL getIndexLevelInfo(
FLMUINT uiNthIndex,
FLMUINT uiBTreeLevel,
XFLM_BTREE_LEVEL_INFO * pLevelInfo);
This method returns information about a specific level in the b-tree of the nth index in the list of indexes for which information has been collected. This method returns FALSE if the uiNthIndex is a number that is out of the range of the number of indexes for which information has been collected. If getNumIndexes reports that there is information for 12 indexes, uiNthIndex must be between 0 and 11 (it is zero-based). If it is not, this method will return FALSE. This method will also return FALSE if the uiBTreeLevel parameter is out of range for the number of levels in the b-tree. If the getIndexInfo routine reports that the b-tree has 3 levels, then the uiBTreeLevel must be a value between 0 and 2 (it is zero-based). If not, this method will return FALSE.
Parameters In:
FLMUINT uiNthIndex This specifies which index in the list of indexes information is to be returned on. It is zero-based. Thus, if the getNumIndexes method returns 12, this should be a number between 0 and 11. FLMUINT uiBTreeLevel This specifies which level of the index's b-tree we want information on. It is zero-based. Thus, if the getIndexInfo method reports that the b-tree has 3 levels, this should be a number between 0 and 2.
Parameters Out:
XFLM_BTREE_LEVEL_INFO * pLevelInfo Information about the specific level in the b-tree is returned in the passed in structure.
Example Code: see clearBTreeInfo
See Also: getCollectionLevelInfo
FLMBOOL getCollectionLevelInfo(
FLMUINT uiNthCollection,
FLMUINT uiBTreeLevel,
XFLM_BTREE_LEVEL_INFO * pLevelInfo);
This method returns information about a specific level in the b-tree of the nth collection in the list of collections for which information has been collected. This method returns FALSE if the uiNthCollection is a number that is out of the range of the number of collections for which information has been collected. If getNumCollections reports that there is information for 12 collections, uiNthCollection must be between 0 and 11 (it is zero-based). If it is not, this method will return FALSE. This method will also return FALSE if the uiBTreeLevel parameter is out of range for the number of levels in the b-tree. If the getCollectionInfo routine reports that the b-tree has 3 levels, then the uiBTreeLevel must be a value between 0 and 2 (it is zero-based). If not, this method will return FALSE.
Parameters In:
FLMUINT uiNthCollection This specifies which collection in the list of collections information is to be returned on. It is zero-based. Thus, if the getNumCollections method returns 12, this should be a number between 0 and 11. FLMUINT uiBTreeLevel This specifies which level of the collection's b-tree we want information on. It is zero-based. Thus, if the getCollectionInfo method reports that the b-tree has 3 levels, this should be a number between 0 and 2.
Parameters Out:
XFLM_BTREE_LEVEL_INFO * pLevelInfo Information about the specific level in the b-tree is returned in the passed in structure.
Example Code: see clearBTreeInfo
See Also: getIndexLevelInfo