Public Attributes | Private Member Functions | Private Attributes | Friends

rm_MediaPool Class Reference
[Resource Manager Database Library]

#include <rmdb.h>

Collaboration diagram for rm_MediaPool:
Collaboration graph
[legend]

List of all members.

Public Attributes

Int32_t mediaPoolKey
rm_String mediaPoolName
rm_String poolUUIDString
Int32_t mediaFamily
Int32_t mediaPoolType
Int32_t maxMediaAge
Int32_t maxNrReadWrite
Int32_t blockSize
Int16_t numOfVolumes
Int16_t sysVolLocation
Int32_t sizeOfSysVol
Int32_t sizeOfVolume
rm_String partitionUUIDString

Private Member Functions

void Insert ()
void Update ()
void Remove (Int32_t a_mediaPoolKey)
void Select (Int32_t a_mediaPoolKey)
void SelectByName (rm_String a_name)
void SelectByUUID (cmn_UUID_t &a_uuid)
void StartSelectAll ()
void EndSelectAll ()
rm_MediaPoolNext ()
 rm_MediaPool ()
 rm_MediaPool (Int32_t a_mediaPoolKey)
bool operator== (const rm_MediaPool &mp1) const

Private Attributes

 log_CLASSID_m

Friends

class rm_Operator
class rm_Medium

Detailed Description

Definition at line 411 of file rmdb.h.


Constructor & Destructor Documentation

rm_MediaPool::rm_MediaPool (  )  [private]
rm_MediaPool::rm_MediaPool ( Int32_t  a_mediaPoolKey  )  [private]

Definition at line 2194 of file librmdb.exx.

References Select().

Here is the call graph for this function:


Member Function Documentation

void rm_MediaPool::EndSelectAll (  )  [private]

Definition at line 2453 of file librmdb.exx.

References errorDesc(), log_FUNC_m, SQL_CHECKREAD_M, and cmn_Mutex::Unlock().

                               {
    log_FUNC_m(EndSelectAll);

    EXEC SQL
        CLOSE SELECT_ALL_MEDIAPOOL;
    g_mediaPoolCursor_x.Unlock();

    string sqlErrDesc = errorDesc(SQLCODE, "CLOSE SELECT_ALL_MEDIAPOOL" );
    SQL_CHECKREAD_M( sqlErrDesc );

}

Here is the call graph for this function:

void rm_MediaPool::Insert (  )  [private]

Definition at line 2202 of file librmdb.exx.

References blockSize, rm_String::cvalue_p, dbg_NORM, errorDesc(), log_DBG_m, log_FUNC_m, MAX, maxMediaAge, maxNrReadWrite, mediaFamily, mediaPoolKey, mediaPoolName, mediaPoolType, NAME, numOfVolumes, partitionUUIDString, poolUUIDString, sizeOfSysVol, sizeOfVolume, SQL_CHECK_M, SQL_NOERROR, SQL_UNIQUEVIOLATION, sysVolLocation, and cmn_UUID_t::ToString().

Referenced by rm_Operator::Add().

                          {
    log_FUNC_m(Insert);

    EXEC SQL
        SET TRANSACTION NAME readWriteTrans;

    Int32_t k = 0;
    if ( mediaPoolKey == 0 ) {
        EXEC SQL
            SELECT TRANSACTION readWriteTrans
            MAX(MEDIAPOOLKEY) INTO :k FROM MEDIAPOOL;
        mediaPoolKey = k + 1;
    }
    else {
        EXEC SQL
            SELECT TRANSACTION readWriteTrans
            MEDIAPOOLKEY INTO :k FROM MEDIAPOOL
            WHERE MEDIAPOOLKEY = :mediaPoolKey;

        if (SQLCODE == SQL_NOERROR) {
            log_DBG_m(dbg_NORM,"key exists");
            throw ivd_DBException( SQL_UNIQUEVIOLATION ,"MediumPool Key already exists");
        }
    }
    cmn_UUID_t uuid;
    poolUUIDString = uuid.ToString();

    if (partitionUUIDString.empty())  bi1 = -1; else bi1 = 0;

    EXEC SQL
        INSERT TRANSACTION readWriteTrans
        INTO MEDIAPOOL VALUES(
                    :mediaPoolKey,
                    :mediaPoolName.cvalue_p,
                    :poolUUIDString.cvalue_p,
                    :mediaFamily,
                    :mediaPoolType,
                    :partitionUUIDString.cvalue_p INDICATOR :bi1,
                    :maxMediaAge,
                    :maxNrReadWrite,
                    :blockSize,
                    :numOfVolumes,
                    :sysVolLocation,
                    :sizeOfSysVol,
                    :sizeOfVolume

               );


    string sqlErrDesc = errorDesc(SQLCODE,"Insert record into MediumPool", mediaPoolKey);
    SQL_CHECK_M( sqlErrDesc );

}//  rm_MediaPool::Insert()

Here is the call graph for this function:

Here is the caller graph for this function:

rm_MediaPool & rm_MediaPool::Next (  )  [private]

Definition at line 2465 of file librmdb.exx.

References blockSize, errorDesc(), ivd_UUID_STR_SIZE_d, log_FUNC_m, maxMediaAge, maxNrReadWrite, mediaFamily, mediaPoolKey, mediaPoolName, mediaPoolType, numOfVolumes, partitionUUIDString, poolUUIDString, sizeOfSysVol, sizeOfVolume, SQL_CHECKREAD_M, SQL_NOERROR, sysVolLocation, and cmn_Mutex::Unlock().

Referenced by rm_Operator::SelectAllMediaPools().

                                 {
    log_FUNC_m(Next);

    char mediaPoolNameVal[rmdb_MAX_MEDIAPOOLNAME];
    char poolUUIDStringVal[ivd_UUID_STR_SIZE_d + 1];
    char partitionUUIDStringVal[ivd_UUID_STR_SIZE_d + 1];

    EXEC SQL
        FETCH SELECT_ALL_MEDIAPOOL
            INTO
                :mediaPoolKey,
                :mediaPoolNameVal,
                :poolUUIDStringVal,
                :mediaFamily,
                :mediaPoolType,
                :partitionUUIDStringVal,
                :maxMediaAge,
                :maxNrReadWrite,
                :blockSize,
                :numOfVolumes,
                :sysVolLocation,
                :sizeOfSysVol,
                :sizeOfVolume;

    if (SQLCODE == SQL_NOERROR) {
        mediaPoolName = mediaPoolNameVal;
        poolUUIDString = poolUUIDStringVal;
        partitionUUIDString = partitionUUIDStringVal;
    }
    else {
        int fetchCode = SQLCODE;
        EXEC SQL
            CLOSE SELECT_ALL_MEDIAPOOL;
        g_mediaPoolCursor_x.Unlock();
        SQLCODE = fetchCode;
        string sqlErrDesc = errorDesc(fetchCode, "CLOSE SELECT_ALL_MEDIAPOOL" );
        SQL_CHECKREAD_M( sqlErrDesc );
    };

    return *this;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool rm_MediaPool::operator== ( const rm_MediaPool mp1  )  const [inline, private]

Definition at line 473 of file rmdb.h.

References mediaPoolKey, rm_Medium::mediaPoolKey, mediaPoolName, and mediaPoolType.

                                                   {
        return (    ( mediaPoolKey == mp1.mediaPoolKey)      &&
                    ( mediaPoolType == mp1.mediaPoolType)    &&
                    ( mediaPoolName == mp1.mediaPoolName)    );
    };

void rm_MediaPool::Remove ( Int32_t  a_mediaPoolKey  )  [private]

Definition at line 2258 of file librmdb.exx.

References errorDesc(), log_FUNC_m, NAME, and SQL_CHECK_M.

Referenced by rm_Operator::RemoveMediaPool().

                                                {
    log_FUNC_m(Remove);
    EXEC SQL
        SET TRANSACTION NAME readWriteTrans;

    EXEC SQL
        DELETE TRANSACTION readWriteTrans
        FROM MEDIAPOOL WHERE MEDIAPOOLKEY = :a_mediaPoolKey;

    string sqlErrDesc = errorDesc(SQLCODE,"Remove MediumPool record", a_mediaPoolKey);
    SQL_CHECK_M( sqlErrDesc );

}//  rm_MediaPool::Remove

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_MediaPool::Select ( Int32_t  a_mediaPoolKey  )  [private]

Definition at line 2306 of file librmdb.exx.

References blockSize, errorDesc(), ivd_UUID_STR_SIZE_d, log_FUNC_m, maxMediaAge, maxNrReadWrite, mediaFamily, mediaPoolKey, mediaPoolName, mediaPoolType, NAME, numOfVolumes, partitionUUIDString, poolUUIDString, sizeOfSysVol, sizeOfVolume, SQL_CHECKREAD_M, SQL_NOERROR, and sysVolLocation.

Referenced by rm_Operator::AllocateAdmin(), rm_MediaPool(), and rm_Operator::SelectMediaPool().

                                                {

    log_FUNC_m(Select);

    EXEC SQL
        SET TRANSACTION NAME readTrans
            READ ONLY
            ISOLATION LEVEL READ COMMITTED;

    char mediaPoolNameVal[rmdb_MAX_MEDIAPOOLNAME];
    char poolUUIDStringVal[ivd_UUID_STR_SIZE_d + 1];
    char partitionUUIDStringVal[ivd_UUID_STR_SIZE_d + 1];

    EXEC SQL
        SELECT TRANSACTION readTrans
        * INTO
                :mediaPoolKey,
                :mediaPoolNameVal,
                :poolUUIDStringVal,
                :mediaFamily,
                :mediaPoolType,
                :partitionUUIDStringVal,
                :maxMediaAge,
                :maxNrReadWrite,
                :blockSize,
                :numOfVolumes,
                :sysVolLocation,
                :sizeOfSysVol,
                :sizeOfVolume
        FROM MEDIAPOOL WHERE MEDIAPOOLKEY = :a_mediaPoolKey;

    if (SQLCODE == SQL_NOERROR) {
        mediaPoolName = mediaPoolNameVal;
        poolUUIDString = poolUUIDStringVal;
        partitionUUIDString = partitionUUIDStringVal;
    };

    string sqlErrDesc = errorDesc(SQLCODE,"Select MediumPool record: ", mediaPoolKey);
    SQL_CHECKREAD_M( sqlErrDesc );
}//  rm_MediaPool::Select

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_MediaPool::SelectByName ( rm_String  a_name  )  [private]

Definition at line 2350 of file librmdb.exx.

References blockSize, rm_String::cvalue_p, errorDesc(), ivd_UUID_STR_SIZE_d, log_FUNC_m, maxMediaAge, maxNrReadWrite, mediaFamily, mediaPoolKey, mediaPoolName, mediaPoolType, NAME, numOfVolumes, partitionUUIDString, poolUUIDString, sizeOfSysVol, sizeOfVolume, SQL_CHECKREAD_M, SQL_NOERROR, and sysVolLocation.

Referenced by rm_Operator::Add(), rm_Operator::RemoveMediaPool(), rm_Operator::SelectMediaPool(), and rm_Operator::Update().

                                                {
    log_FUNC_m(SelectByName);

    EXEC SQL
        SET TRANSACTION NAME readTrans
            READ ONLY
            ISOLATION LEVEL READ COMMITTED;

    char mediaPoolNameVal[rmdb_MAX_MEDIAPOOLNAME];
    char poolUUIDStringVal[ivd_UUID_STR_SIZE_d + 1];
    char partitionUUIDStringVal[ivd_UUID_STR_SIZE_d + 1];

    EXEC SQL
        SELECT TRANSACTION readTrans
        * INTO
                :mediaPoolKey,
                :mediaPoolNameVal,
                :poolUUIDStringVal,
                :mediaFamily,
                :mediaPoolType,
                :partitionUUIDStringVal,
                :maxMediaAge,
                :maxNrReadWrite,
                :blockSize,
                :numOfVolumes,
                :sysVolLocation,
                :sizeOfSysVol,
                :sizeOfVolume
         FROM MEDIAPOOL WHERE MEDIAPOOLNAME = :a_name.cvalue_p;

    if (SQLCODE == SQL_NOERROR) {
        mediaPoolName = mediaPoolNameVal;
        poolUUIDString = poolUUIDStringVal;
        partitionUUIDString = partitionUUIDStringVal;
    };
    string sqlErrDesc = errorDesc(SQLCODE,"Select MediumPool record by Name: "+ a_name);
    SQL_CHECKREAD_M( sqlErrDesc );
}

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_MediaPool::SelectByUUID ( cmn_UUID_t a_uuid  )  [private]

Definition at line 2390 of file librmdb.exx.

References blockSize, rm_String::cvalue_p, errorDesc(), ivd_UUID_STR_SIZE_d, log_FUNC_m, maxMediaAge, maxNrReadWrite, mediaFamily, mediaPoolKey, mediaPoolName, mediaPoolType, NAME, numOfVolumes, partitionUUIDString, poolUUIDString, sizeOfSysVol, sizeOfVolume, SQL_CHECKREAD_M, SQL_NOERROR, sysVolLocation, and cmn_UUID_t::ToString().

Referenced by rm_Operator::SelectMediaPoolbyUUID().

                                                  {
    log_FUNC_m(SelectByUUID);

    EXEC SQL
        SET TRANSACTION NAME readTrans
            READ ONLY
            ISOLATION LEVEL READ COMMITTED;

    char mediaPoolNameVal[rmdb_MAX_MEDIAPOOLNAME];
    char poolUUIDStringVal[ivd_UUID_STR_SIZE_d + 1];
    char partitionUUIDStringVal[ivd_UUID_STR_SIZE_d + 1];

    rm_String uuid(ivd_UUID_STR_SIZE_d);
    uuid = a_uuid.ToString();

    EXEC SQL
        SELECT TRANSACTION readTrans
        * INTO
                        :mediaPoolKey,
                        :mediaPoolNameVal,
                        :poolUUIDStringVal,
                        :mediaFamily,
                        :mediaPoolType,
                        :partitionUUIDStringVal,
                        :maxMediaAge,
                        :maxNrReadWrite,
                        :blockSize,
                        :numOfVolumes,
                        :sysVolLocation,
                        :sizeOfSysVol,
                        :sizeOfVolume
                 FROM MEDIAPOOL WHERE POOLUUID = :uuid.cvalue_p;

    if (SQLCODE == SQL_NOERROR) {
        mediaPoolName = mediaPoolNameVal;
        poolUUIDString = poolUUIDStringVal;
        partitionUUIDString = partitionUUIDStringVal;
    };
    string sqlErrDesc = errorDesc(SQLCODE, "Selecting MediumPool record by Name. Search String was:" , uuid);
    SQL_CHECKREAD_M( sqlErrDesc );
}

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_MediaPool::StartSelectAll (  )  [private]

Definition at line 2433 of file librmdb.exx.

References errorDesc(), cmn_Mutex::Lock(), log_ERR_m, log_FUNC_m, NAME, SQL_NOERROR, and cmn_Mutex::Unlock().

Referenced by rm_Operator::SelectAllMediaPools().

                                 {
    log_FUNC_m(StartSelectAll);

    g_mediaPoolCursor_x.Lock();
    EXEC SQL
        SET TRANSACTION NAME readTrans
            READ ONLY
            ISOLATION LEVEL READ COMMITTED;

    EXEC SQL
        OPEN TRANSACTION readTrans
        SELECT_ALL_MEDIAPOOL;
    if ( SQLCODE != SQL_NOERROR ) {
        string sqlErrDesc = errorDesc(SQLCODE, "Opening SELECT_ALL_MEDIAPOOL Cursor failed");
        log_ERR_m(sqlErrDesc);
        g_mediaPoolCursor_x.Unlock();
        throw ivd_DBException( SQLCODE ,sqlErrDesc, true);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_MediaPool::Update (  )  [private]

Definition at line 2274 of file librmdb.exx.

References blockSize, rm_String::cvalue_p, errorDesc(), log_FUNC_m, maxMediaAge, maxNrReadWrite, mediaFamily, mediaPoolKey, mediaPoolName, mediaPoolType, NAME, numOfVolumes, partitionUUIDString, sizeOfSysVol, sizeOfVolume, SQL_CHECK_M, and sysVolLocation.

Referenced by rm_Operator::Update().

                          {
    log_FUNC_m(Update);
    if (partitionUUIDString.empty())  bi1 = -1; else bi1 = 0;

    EXEC SQL
        SET TRANSACTION NAME readWriteTrans;
    //ATTENTION!!! Update will not update mediaPoolUUID
    EXEC SQL
        UPDATE TRANSACTION readWriteTrans
        MEDIAPOOL SET
                MEDIAPOOLNAME   = :mediaPoolName.cvalue_p,
                POOLUUID        = POOLUUID,
                MEDIAFAMILY     = :mediaFamily,
                MEDIAPOOLTYPE   = :mediaPoolType,
                PARTITIONUUID   = :partitionUUIDString.cvalue_p INDICATOR :bi1,
                MAXMEDIAAGE     = :maxMediaAge,
                MAXNRREADWRITE  = :maxNrReadWrite,
                BLOCKSIZE       = :blockSize,
                NUMOFVOLUMES    = :numOfVolumes,
                IDXOFSYSVOL     = :sysVolLocation,
                SIZEOFSYSVOL    = :sizeOfSysVol,
                SIZEOFVOLUME    = :sizeOfVolume
        WHERE MEDIAPOOLKEY = :mediaPoolKey;

    string sqlErrDesc = errorDesc(SQLCODE,"Update MediumPool record", mediaPoolKey);
    SQL_CHECK_M( sqlErrDesc );

}//  rm_MediaPool::Update()

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class rm_Medium [friend]

Definition at line 414 of file rmdb.h.

friend class rm_Operator [friend]

Definition at line 413 of file rmdb.h.


Member Data Documentation

Definition at line 477 of file rmdb.h.


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