Public Member Functions | Public Attributes | Private Member Functions | Friends

rm_Partition Class Reference
[Resource Manager Database Library]

#include <rmdb.h>

Collaboration diagram for rm_Partition:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 rm_Partition ()
 rm_Partition (const rm_Partition &a_part)
rm_Partitionoperator= (const rm_Partition &a_part)
bool operator== (const rm_Partition &part) const

Public Attributes

rm_String partitionUUIDString
rm_String partitionName
Int32_t options
rm_String fsHost
rm_String fsMountpoint
Int32_t migIdTime
Int32_t migIdCount
Int32_t status
rm_String fsID
cmn_UUID_t partUUID
rm_MigIdGen m_migIdGen
 log_CLASSID_m

Private Member Functions

void Insert ()
void Update ()
void Remove (const rm_String &a_partName)
void Select (const rm_String &a_partUUID)
void SelectByName (const rm_String &a_partName)
void SelectByUuid (const rm_String &a_partUuid)
void StartSelectAll ()
void EndSelectAll ()
rm_PartitionNext ()
void Init (const string &a_partName)

Friends

class rm_Operator
class rm_MigIdGen
class dbo_InitPartition
class dbo_InsertPartition
class dbo_RemovePartition
class dbo_SelectPartition
class rm_Medium

Detailed Description

Definition at line 683 of file rmdb.h.


Constructor & Destructor Documentation

rm_Partition::rm_Partition (  ) 
rm_Partition::rm_Partition ( const rm_Partition a_part  ) 

Member Function Documentation

void rm_Partition::EndSelectAll (  )  [private]

Definition at line 4237 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_PARTITION;

    g_partitionCursor_x.Unlock();

    string sqlErrDesc = errorDesc(SQLCODE, "Closing SELECT_ALL_PARTITION Cursor failed");
    SQL_CHECKREAD_M(sqlErrDesc);

}

Here is the call graph for this function:

void rm_Partition::Init ( const string &  a_partName  )  [private]

Definition at line 3973 of file librmdb.exx.

References rm_MigIdGen::Init(), log_FUNC_m, m_migIdGen, partitionName, partitionUUIDString, partUUID, rmdb_MAX_PARTITIONNAME, and SelectByName().

Referenced by dbo_InitPartition::Process().

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Partition::Insert (  )  [private]

Definition at line 4011 of file librmdb.exx.

References rm_String::cvalue_p, errorDesc(), fsHost, fsID, fsMountpoint, log_FUNC_m, migIdCount, migIdTime, NAME, options, partitionName, partitionUUIDString, SQL_CHECK_M, and status.

Referenced by rm_Operator::InsertPartition().

                          {
    log_FUNC_m(Insert);
    EXEC SQL
        SET TRANSACTION NAME readWriteTrans;
    EXEC SQL
        INSERT TRANSACTION readWriteTrans
        INTO Partition VALUES(
                              :partitionUUIDString.cvalue_p,
                              :partitionName.cvalue_p,
                              :migIdTime,
                              :migIdCount,
                              :status,
                              :options,
                              :fsHost.cvalue_p,
                              :fsMountpoint.cvalue_p,
                              :fsID.cvalue_p
                             );

    string sqlErrDesc = errorDesc(SQLCODE,"Insert record into Partition with uuid " + partitionUUIDString );
    SQL_CHECK_M( sqlErrDesc );

} // rm_Partition::Insert()

Here is the call graph for this function:

Here is the caller graph for this function:

rm_Partition & rm_Partition::Next (  )  [private]

Definition at line 4250 of file librmdb.exx.

References errorDesc(), fsHost, fsID, fsMountpoint, ivd_UUID_STR_SIZE_d, log_FUNC_m, migIdCount, migIdTime, options, partitionName, partitionUUIDString, SQL_CHECKREAD_M, SQL_NOERROR, status, and cmn_Mutex::Unlock().

Referenced by rm_Operator::SelectAllPart().

                                 {
    log_FUNC_m(Next);

    char uuidVal[ivd_UUID_STR_SIZE_d + 1];
    char partitionNameVal[rmdb_MAX_PARTITIONNAME];
    char fsHostVal[rmdb_MAX_HOSTNAME];
    char fsMountpointVal[rmdb_MAX_MOUNTPOINT];
    char fsIDVal[rmdb_MAX_FSID];

    EXEC SQL
        FETCH SELECT_ALL_PARTITION
            INTO
                :uuidVal,
                :partitionNameVal,
                :migIdTime,
                :migIdCount,
                :status,
                :options,
                :fsHostVal,
                :fsMountpointVal,
                :fsIDVal;

    if (SQLCODE == SQL_NOERROR) {
        partitionUUIDString = uuidVal;
        partitionName = partitionNameVal;
        fsHost = fsHostVal;
        fsMountpoint = fsMountpointVal;
        fsID = fsIDVal;
    }
    else {
        int fetchCode = SQLCODE;
        EXEC SQL
            CLOSE SELECT_ALL_PARTITION;

        g_partitionCursor_x.Unlock();
        SQLCODE = fetchCode;
        string sqlErrDesc = errorDesc(fetchCode, "reached end of SELECT_ALL_PARTITION cursor");
        SQL_CHECKREAD_M(sqlErrDesc);
    };
    return *this;

}

Here is the call graph for this function:

Here is the caller graph for this function:

rm_Partition & rm_Partition::operator= ( const rm_Partition a_part  ) 

Definition at line 4293 of file librmdb.exx.

References fsHost, fsID, fsMountpoint, rm_MigIdGen::Init(), log_FUNC_m, m_migIdGen, migIdCount, migIdTime, options, partitionName, partitionUUIDString, and status.

                                                               {
    log_FUNC_m(operator=);
    partitionUUIDString = a_part.partitionUUIDString;
    partitionName = a_part.partitionName;
    options = a_part.options;
    fsHost = a_part.fsHost;
    fsMountpoint = a_part.fsMountpoint;
    migIdTime = a_part.migIdTime;
    migIdCount = a_part.migIdCount;
    status = a_part.status;
    fsID= a_part.fsID;
    m_migIdGen.Init(this);
    return *this;
}

Here is the call graph for this function:

bool rm_Partition::operator== ( const rm_Partition part  )  const [inline]

Definition at line 744 of file rmdb.h.

References partitionUUIDString.

                                                    {
        return (    ( partitionUUIDString == part.partitionUUIDString ) );
    };

void rm_Partition::Remove ( const rm_String a_partName  )  [private]

Definition at line 4037 of file librmdb.exx.

References rm_String::cvalue_p, errorDesc(), log_FUNC_m, NAME, and SQL_CHECK_M.

Referenced by rm_Operator::RemovePartition().

                                                    {
    log_FUNC_m(Remove);

    EXEC SQL
        SET TRANSACTION NAME readWriteTrans;
    EXEC SQL
        DELETE TRANSACTION readWriteTrans
        FROM Partition
            WHERE
                partName = :a_partName.cvalue_p;

    string sqlErrDesc = errorDesc(SQLCODE,"Remove record from Partition with Name " + a_partName);
    SQL_CHECK_M( sqlErrDesc );
} // rm_Partition::Remove()

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Partition::Select ( const rm_String a_partUUID  )  [private]

Definition at line 4083 of file librmdb.exx.

References rm_String::cvalue_p, dbg_DETAIL, errorDesc(), fsHost, fsID, fsMountpoint, ivd_UUID_STR_SIZE_d, log_DBG_m, log_FUNC_m, migIdCount, migIdTime, NAME, options, partitionName, partitionUUIDString, partUUID, SQL_CHECKREAD_M, SQL_NOERROR, and status.

Referenced by rm_MigIdGen::CheckInDB().

                                                     {
    log_FUNC_m(Select);

    char uuidVal[ivd_UUID_STR_SIZE_d + 1 ];
    char partitionNameVal[rmdb_MAX_PARTITIONNAME];
    char fsHostVal[rmdb_MAX_HOSTNAME];
    char fsMountpointVal[rmdb_MAX_MOUNTPOINT];
    char fsIDVal[rmdb_MAX_FSID];

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

    EXEC SQL
        SELECT TRANSACTION readTrans
        * INTO
            :uuidVal,
            :partitionNameVal,
            :migIdTime,
            :migIdCount,
            :status,
            :options,
            :fsHostVal,
            :fsMountpointVal,
            :fsIDVal
        FROM PARTITION WHERE (partUUID = :a_partUUID.cvalue_p);

    log_DBG_m(dbg_DETAIL, "selected Partition record " << SQLCODE);


    if (SQLCODE == SQL_NOERROR){
        partitionUUIDString = uuidVal;
        partitionName = partitionNameVal;
        fsHost = fsHostVal;
        fsMountpoint = fsMountpointVal;
        fsID = fsIDVal;
    }
    string sqlErrDesc = errorDesc(SQLCODE," Select Partition ", a_partUUID);
    SQL_CHECKREAD_M( sqlErrDesc );

} // rm_Partition::Select

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Partition::SelectByName ( const rm_String a_partName  )  [private]

Definition at line 4127 of file librmdb.exx.

References rm_String::cvalue_p, dbg_DETAIL, errorDesc(), fsHost, fsID, fsMountpoint, ivd_UUID_STR_SIZE_d, log_DBG_m, log_FUNC_m, migIdCount, migIdTime, NAME, options, partitionName, partitionUUIDString, SQL_CHECKREAD_M, SQL_NOERROR, and status.

Referenced by Init(), and rm_Operator::SelectPartition().

                                                           {
    log_FUNC_m(SelectByName);

    char uuidVal[ivd_UUID_STR_SIZE_d + 1];
    char partitionNameVal[rmdb_MAX_PARTITIONNAME];
    char fsHostVal[rmdb_MAX_HOSTNAME];
    char fsMountpointVal[rmdb_MAX_MOUNTPOINT];
    char fsIDVal[rmdb_MAX_FSID];

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

    EXEC SQL
        SELECT TRANSACTION readTrans
        * INTO
            :uuidVal,
            :partitionNameVal,
            :migIdTime,
            :migIdCount,
            :status,
            :options,
            :fsHostVal,
            :fsMountpointVal,
            :fsIDVal
        FROM PARTITION WHERE (partName = :a_partName.cvalue_p);

    log_DBG_m(dbg_DETAIL, "selected Partition record. SQLCODE: " << SQLCODE);

    if (SQLCODE == SQL_NOERROR){
        partitionUUIDString = uuidVal;
        partitionName = partitionNameVal;
        fsHost = fsHostVal;
        fsMountpoint = fsMountpointVal;
        fsID = fsIDVal;
    }

    string sqlErrDesc = errorDesc(SQLCODE," Select Partition " , a_partName);
    SQL_CHECKREAD_M( sqlErrDesc );

} // rm_Partition::Select

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Partition::SelectByUuid ( const rm_String a_partUuid  )  [private]

Definition at line 4171 of file librmdb.exx.

References rm_String::cvalue_p, dbg_DETAIL, errorDesc(), fsHost, fsID, fsMountpoint, ivd_UUID_STR_SIZE_d, log_DBG_m, log_FUNC_m, migIdCount, migIdTime, NAME, options, partitionName, partitionUUIDString, partUUID, SQL_CHECKREAD_M, SQL_NOERROR, and status.

Referenced by rm_Medium::Convert2Corba(), rm_Operator::SelectMedium(), and rm_Operator::SelectPartitionByUuid().

                                                           {
    log_FUNC_m(SelectByNameByUuid);

    char uuidVal[ivd_UUID_STR_SIZE_d + 1];
    char partitionNameVal[rmdb_MAX_PARTITIONNAME];
    char fsHostVal[rmdb_MAX_HOSTNAME];
    char fsMountpointVal[rmdb_MAX_MOUNTPOINT];
    char fsIDVal[rmdb_MAX_FSID];

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

    EXEC SQL
        SELECT TRANSACTION readTrans
        * INTO
        :uuidVal,
        :partitionNameVal,
        :migIdTime,
        :migIdCount,
        :status,
        :options,
        :fsHostVal,
        :fsMountpointVal,
        :fsIDVal
        FROM PARTITION WHERE (partUUID = :a_partUuid.cvalue_p);

    log_DBG_m(dbg_DETAIL, "selected Partition record " << SQLCODE);

    if (SQLCODE == SQL_NOERROR){
        partitionUUIDString = uuidVal;
        partitionName = partitionNameVal;
        fsHost = fsHostVal;
        fsMountpoint = fsMountpointVal;
        fsID = fsIDVal;
    }

    string sqlErrDesc = errorDesc(SQLCODE," Select Partition By UUID " , a_partUuid);
    SQL_CHECKREAD_M( sqlErrDesc );

} // rm_Partition::SelectByNameByUuid

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Partition::StartSelectAll (  )  [private]

Definition at line 4214 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::SelectAllPart().

                                 {
    log_FUNC_m(StartSelectAll);

    g_partitionCursor_x.Lock();

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

    EXEC SQL
        OPEN TRANSACTION readTrans
        SELECT_ALL_PARTITION;

    if ( SQLCODE != SQL_NOERROR ) {
        string sqlErrDesc = errorDesc(SQLCODE, "Opening SELECT_ALL_PARTITION Cursor failed");
        log_ERR_m(sqlErrDesc);
        g_partitionCursor_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_Partition::Update (  )  [private]

Definition at line 4055 of file librmdb.exx.

References rm_String::cvalue_p, errorDesc(), fsHost, fsID, fsMountpoint, log_FUNC_m, migIdCount, migIdTime, NAME, options, partitionName, partitionUUIDString, SQL_CHECK_M, and status.

Referenced by rm_MigIdGen::UpdateInDB(), and rm_Operator::UpdatePartition().

                          {
    log_FUNC_m(Update);

    EXEC SQL
        SET TRANSACTION NAME readWriteTrans;
    EXEC SQL
        UPDATE TRANSACTION readWriteTrans
        PARTITION SET
            PARTUUID    = :partitionUUIDString.cvalue_p,
            PARTNAME    = :partitionName.cvalue_p,
            OPTIONS     = :options,
            FSHOST      = :fsHost.cvalue_p,
            FSMOUNTPOINT = :fsMountpoint.cvalue_p,
            MIGIDTIME   = :migIdTime,
            MIGIDCOUNT  = :migIdCount,
            STATUS      = :status,
            FSID        = :fsID.cvalue_p
        WHERE
            PARTNAME = :partitionName.cvalue_p;

    string sqlErrDesc = errorDesc(SQLCODE,"Update record in Partition: " + partitionName);
    SQL_CHECK_M( sqlErrDesc );

} // rm_update_Drivehost

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class dbo_InitPartition [friend]

Definition at line 687 of file rmdb.h.

friend class dbo_InsertPartition [friend]

Definition at line 688 of file rmdb.h.

friend class dbo_RemovePartition [friend]

Definition at line 689 of file rmdb.h.

friend class dbo_SelectPartition [friend]

Definition at line 690 of file rmdb.h.

friend class rm_Medium [friend]

Definition at line 691 of file rmdb.h.

friend class rm_MigIdGen [friend]

Definition at line 686 of file rmdb.h.

friend class rm_Operator [friend]

Definition at line 685 of file rmdb.h.


Member Data Documentation

Definition at line 746 of file rmdb.h.


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