Classes | Defines | Typedefs | Functions

Resource Manager Database Library
[Server]

The RMDB Library contains classes for: More...

Collaboration diagram for Resource Manager Database Library:

Classes

class  rm_TimeStamp
class  rm_String
class  ivd_DBException
class  rm_Library
class  rm_Drive
class  rm_DriveHost
class  rm_DiskSubsys
class  rm_Slot
class  rm_MediaPool
class  rm_Medium
class  rm_MediumVol
class  rm_JobIdGen
 JobID Generator Generates a new Job ID on request. More...
class  rm_MigIdGen
 Migration Id Generator Generates a new Migration ID per IVD-Partition on request. More...
class  rm_Partition
class  rm_DB
struct  rm_MediumPos_t
struct  rm_CopyPos_t
class  rm_MajorCol
class  rm_MinorCol
class  rm_ColMediaVol
struct  rm_ColAlloc

Defines

#define SQL_NOERROR   (0)
#define SQL_100   (100)
#define SQL_NOTFOUND   (SQL_100)
#define SQL_DEADLOCK   (-913)
#define SQL_FKVIOLATION   (-530)
#define SQL_UNIQUEVIOLATION   (-803)
#define SQL_MULTIPLERECORDS   (100)
#define RM_ALLOC_FAILUE   (1000)
#define IB_TABLE_NAME_SIZE   (31)
#define rmdb_MAX_LIBRARYNAME   50
#define rmdb_MAX_MEDIAPOOLNAME   50
#define rmdb_MAX_PARTITIONNAME   50
#define rmdb_MAX_DRIVENAME   50
#define rmdb_MAX_HOSTNAME   192
#define rmdb_MAX_MOUNTPOINT   255
#define rmdb_MAX_FSID   128
#define rmdb_MAX_CTRLDEVICE   255
#define rmdb_MAX_DRIVEIDX   64
#define rmdb_MAX_BARCODE   64
#define rmdb_MAX_VENDORID   32
#define rmdb_MAX_PRODUCTID   32
#define rmdb_MAX_SERIALNO   128
#define rmdb_MAX_UUID   36
#define rmdb_MAX_FIRMWAREREV   32
#define rmdb_MAX_SCSIID   32
#define rmdb_MAX_SLOTADDR   64
#define rmdb_MAX_LOCATION   255
#define rmdb_MAX_MEDIUMSERIALNO   128
#define rmdb_MAX_DSSNAME   50
#define rmdb_INIT_LIBRARY_STATUS   (ls_ONLINE)
#define rmdb_LIBRARY_ERROR   (ls_ERROR)
#define rmdb_LIBRARY_DISABLED   (ls_DISABLED)
#define elem_DRIVE   (0x04)
#define elem_SLOT   (0x02)
#define elem_MAILSLOT   (0x03)
#define rmdb_REP_SLOT_TYPE_ID   (st_REPOSITORY)
 Slot type identifiers for RMDB.
#define rmdb_MAIL_SLOT_TYPE_ID   (st_MAIL)
#define rmdb_CLEAN_SLOT_TYPE_ID   (st_CLEAN)
#define rmdb_INIT_DRIVE_STATUS   (ds_ONLINE)
#define rmdb_DRIVE_IN_USE   (ds_INUSE)
#define rmdb_DRIVE_ERROR   (ds_ERROR)
#define rmdb_DRIVE_DISABLED   (ds_DISABLED)
#define rmdb_INIT_DSS_STATUS   (0)
#define rmdb_DSS_IN_USE   (1 << 0)
#define rmdb_SLOT_FREE   (ss_FREE)
#define rmdb_SLOT_IN_USE   (ss_SLOTINUSE)
#define rmdb_DATA_VOLUME   (0)
 System/data volume identifiers for RMDB.
#define rmdb_SYSTEM_VOLUME   (1)
#define rmdb_PARTITION_ENABLED   (rmdb_PARTITION_ENABLED_d)
 Partition status identifiers for RMDB.
#define rmdb_PARTITION_DISABLED   (rmdb_PARTITION_DISABLED_d)
#define rmdb_PARTITION_RECOVERY_MODE   (rmdb_PARTITION_RECOVERY_MODE_d)
#define rmdb_PARTITION_REORG_SCAN_INPROG   (rmdb_PARTITION_REORG_SCAN_INPROG_d)
#define rmdb_PARTITION_OPTION_NOT_SET   (fst_UNKNOWN)
 Partition option identifiers for RMDB.
#define rmdb_PARTITION_OPTION_REGULAR   (fst_REGULAR)
#define rmdb_PARTITION_OPTION_WORM   (fst_WORM)
#define rmdb_INIT_MEDIUM_STATUS   (ms_UNKNOWN)
#define rmdb_MEDIUM_IN_USE   (ms_INUSE)
#define rmdb_MEDIUM_OPEN   (ms_OPEN)
#define rmdb_MEDIUM_UNUSABLE   (ms_UNUSABLE)
#define rmdb_MEDIUM_UNRELIABLE   (ms_UNRELIABLE)
#define rmdb_MEDIUM_FULL   (ms_FULL)
#define rmdb_MEDIUM_OFFLINE   (ms_OFFLINE)
#define rmdb_INIT_MEDIUMVOL_STATUS   (mvs_EMPTY)
#define rmdb_MEDVOL_EMPTY   (mvs_EMPTY)
#define rmdb_MEDVOL_USED   (mvs_OPEN)
#define rmdb_MEDVOL_FULL   (mvs_FULL)
#define rmdb_MEDVOL_ERROR   (mvs_ERROR)
#define rmdb_MEDVOL_RECOVER   (mvs_RECOVER)
#define rmdb_MEDVOL_REORG_SCANNED   (mvs_REORG_SCANNED)
#define rmdb_MEDVOL_REORG_INREORG   (mvs_REORG_INREORG)
#define rmdb_MEDVOL_REORG_RECYCLED   (mvs_REORG_RECYCLED)

Typedefs

typedef vector< rm_Mediumrm_MedList
typedef vector< rm_CopyPos_trm_CopiesPos_v_t

Functions

static long int isc_dsql_execute_m (long int *a_statusVector, void **a_dbHandle, void **a_trHandle, short unsigned int a_stmtLength, char *a_stmt, int a_6, short unsigned int a_7, char *a_xsqlda)
int FB_shutdownCallback (const int reason, const int mask, void *arg)
void TableExists (char[IB_TABLE_NAME_SIZE])

Detailed Description

The RMDB Library contains classes for:

  1. Insert, select, update and removing of database records,
  2. Resource Allocation policies,
  3. Job Id Generation,
  4. Migration ID Generation,
  5. other methods like VolumeFull, DriveError, MediumLoaded etc.

All operation are performed through a single thread (class rm_DBThread). For this purpose all operations are packed in classes wich provide sequential execution (see also: class rm_DBOperation)


Define Documentation

#define elem_DRIVE   (0x04)

Definition at line 91 of file rmdb_defines.h.

Referenced by rm_Operator::InventoryUpdate().

#define elem_MAILSLOT   (0x03)

Definition at line 93 of file rmdb_defines.h.

#define elem_SLOT   (0x02)

Definition at line 92 of file rmdb_defines.h.

#define IB_TABLE_NAME_SIZE   (31)

Definition at line 54 of file rmdb_defines.h.

#define RM_ALLOC_FAILUE   (1000)

Definition at line 52 of file rmdb_defines.h.

Referenced by rm_Operator::AllocateAdmin().

#define rmdb_CLEAN_SLOT_TYPE_ID   (st_CLEAN)

Definition at line 98 of file rmdb_defines.h.

#define rmdb_DATA_VOLUME   (0)

System/data volume identifiers for RMDB.

Definition at line 115 of file rmdb_defines.h.

Referenced by i_AdminJob_i::DoInitialize(), rm_Operator::PoolInfo(), dbo_SetReorgScan::Process(), and rm_Operator::SelectMediumVolumeMig().

#define rmdb_DRIVE_DISABLED   (ds_DISABLED)
#define rmdb_DRIVE_ERROR   (ds_ERROR)
#define rmdb_DRIVE_IN_USE   (ds_INUSE)
#define rmdb_DSS_IN_USE   (1 << 0)

Definition at line 109 of file rmdb_defines.h.

Referenced by rm_Operator::RemoveDSS().

#define rmdb_INIT_DRIVE_STATUS   (ds_ONLINE)

Definition at line 101 of file rmdb_defines.h.

#define rmdb_INIT_DSS_STATUS   (0)

Definition at line 108 of file rmdb_defines.h.

#define rmdb_INIT_LIBRARY_STATUS   (ls_ONLINE)
#define rmdb_INIT_MEDIUM_STATUS   (ms_UNKNOWN)

Definition at line 131 of file rmdb_defines.h.

Referenced by i_AdminJob_i::Initialize().

#define rmdb_INIT_MEDIUMVOL_STATUS   (mvs_EMPTY)

Definition at line 146 of file rmdb_defines.h.

#define rmdb_LIBRARY_DISABLED   (ls_DISABLED)
#define rmdb_LIBRARY_ERROR   (ls_ERROR)
#define rmdb_MAIL_SLOT_TYPE_ID   (st_MAIL)

Definition at line 97 of file rmdb_defines.h.

Referenced by i_ManagementInterface_i::UpdateLibrary().

#define rmdb_MAX_BARCODE   64
#define rmdb_MAX_CTRLDEVICE   255

Definition at line 70 of file rmdb_defines.h.

#define rmdb_MAX_DRIVEIDX   64

Definition at line 71 of file rmdb_defines.h.

Referenced by rm_Operator::InventoryUpdate(), and rm_Operator::MediumLoaded().

#define rmdb_MAX_DRIVENAME   50
#define rmdb_MAX_DSSNAME   50

Definition at line 82 of file rmdb_defines.h.

Referenced by rm_Operator::Add(), rm_Operator::RemoveDSS(), and rm_Operator::Update().

#define rmdb_MAX_FIRMWAREREV   32

Definition at line 77 of file rmdb_defines.h.

#define rmdb_MAX_FSID   128

Definition at line 69 of file rmdb_defines.h.

#define rmdb_MAX_HOSTNAME   192

Definition at line 67 of file rmdb_defines.h.

Referenced by rm_Operator::RemoveDriveHost(), and rm_Operator::SelectDriveHost().

#define rmdb_MAX_LIBRARYNAME   50
#define rmdb_MAX_LOCATION   255

Definition at line 80 of file rmdb_defines.h.

#define rmdb_MAX_MEDIAPOOLNAME   50
#define rmdb_MAX_MEDIUMSERIALNO   128

Definition at line 81 of file rmdb_defines.h.

#define rmdb_MAX_MOUNTPOINT   255

Definition at line 68 of file rmdb_defines.h.

#define rmdb_MAX_PARTITIONNAME   50
#define rmdb_MAX_PRODUCTID   32

Definition at line 74 of file rmdb_defines.h.

#define rmdb_MAX_SCSIID   32

Definition at line 78 of file rmdb_defines.h.

#define rmdb_MAX_SERIALNO   128

Definition at line 75 of file rmdb_defines.h.

#define rmdb_MAX_SLOTADDR   64
#define rmdb_MAX_UUID   36
#define rmdb_MAX_VENDORID   32

Definition at line 73 of file rmdb_defines.h.

#define rmdb_MEDIUM_FULL   (ms_FULL)
#define rmdb_MEDIUM_IN_USE   (ms_INUSE)
#define rmdb_MEDIUM_OFFLINE   (ms_OFFLINE)
#define rmdb_MEDIUM_OPEN   (ms_OPEN)
#define rmdb_MEDIUM_UNRELIABLE   (ms_UNRELIABLE)
#define rmdb_MEDIUM_UNUSABLE   (ms_UNUSABLE)
#define rmdb_MEDVOL_EMPTY   (mvs_EMPTY)
#define rmdb_MEDVOL_ERROR   (mvs_ERROR)

Definition at line 150 of file rmdb_defines.h.

Referenced by rm_Operator::SelectOpenedVolume().

#define rmdb_MEDVOL_FULL   (mvs_FULL)
#define rmdb_MEDVOL_RECOVER   (mvs_RECOVER)
#define rmdb_MEDVOL_REORG_INREORG   (mvs_REORG_INREORG)
#define rmdb_MEDVOL_REORG_RECYCLED   (mvs_REORG_RECYCLED)
#define rmdb_MEDVOL_REORG_SCANNED   (mvs_REORG_SCANNED)
#define rmdb_MEDVOL_USED   (mvs_OPEN)
#define rmdb_PARTITION_DISABLED   (rmdb_PARTITION_DISABLED_d)
#define rmdb_PARTITION_ENABLED   (rmdb_PARTITION_ENABLED_d)

Partition status identifiers for RMDB.

Definition at line 120 of file rmdb_defines.h.

Referenced by i_ManagementInterface_i::EnablePartition().

#define rmdb_PARTITION_OPTION_NOT_SET   (fst_UNKNOWN)

Partition option identifiers for RMDB.

Definition at line 126 of file rmdb_defines.h.

#define rmdb_PARTITION_OPTION_REGULAR   (fst_REGULAR)

Definition at line 127 of file rmdb_defines.h.

#define rmdb_PARTITION_OPTION_WORM   (fst_WORM)

Definition at line 128 of file rmdb_defines.h.

#define rmdb_PARTITION_RECOVERY_MODE   (rmdb_PARTITION_RECOVERY_MODE_d)
#define rmdb_PARTITION_REORG_SCAN_INPROG   (rmdb_PARTITION_REORG_SCAN_INPROG_d)
#define rmdb_REP_SLOT_TYPE_ID   (st_REPOSITORY)

Slot type identifiers for RMDB.

Definition at line 96 of file rmdb_defines.h.

Referenced by rm_Operator::InventoryUpdate(), and i_ManagementInterface_i::UpdateLibrary().

#define rmdb_SLOT_FREE   (ss_FREE)

Definition at line 111 of file rmdb_defines.h.

Referenced by i_ManagementInterface_i::ShowLibraryInventory().

#define rmdb_SLOT_IN_USE   (ss_SLOTINUSE)
#define rmdb_SYSTEM_VOLUME   (1)
#define SQL_100   (100)

Definition at line 45 of file rmdb_defines.h.

#define SQL_DEADLOCK   (-913)

Definition at line 47 of file rmdb_defines.h.

#define SQL_FKVIOLATION   (-530)

Definition at line 48 of file rmdb_defines.h.

#define SQL_MULTIPLERECORDS   (100)

Definition at line 50 of file rmdb_defines.h.

#define SQL_NOERROR   (0)

Definition at line 44 of file rmdb_defines.h.

Referenced by rm_DB::Connect(), rm_DB::Disconnect(), rm_DB::ExistExtFunctions(), rm_Medium::Insert(), rm_Slot::Insert(), rm_MediaPool::Insert(), rm_DiskSubsys::Insert(), rm_Drive::Insert(), rm_Operator::MajorColIdMatches(), rm_ColMediaVol::Next(), rm_MinorCol::Next(), rm_MajorCol::Next(), rm_Partition::Next(), rm_MediumVol::Next(), rm_Medium::Next(), rm_Slot::Next(), rm_MediaPool::Next(), rm_DiskSubsys::Next(), rm_DriveHost::Next(), rm_Drive::Next(), rm_Library::Next(), rm_Partition::Select(), rm_MediumVol::Select(), rm_Medium::Select(), rm_Slot::Select(), rm_MediaPool::Select(), rm_DiskSubsys::Select(), rm_DriveHost::Select(), rm_Drive::Select(), rm_Library::Select(), rm_ColMediaVol::SelectAll(), rm_MinorCol::SelectAll(), rm_Drive::SelectAll(), rm_Drive::SelectByAddr(), rm_Medium::SelectByBarcode(), rm_Medium::SelectByDrive(), rm_Slot::SelectByLibAddrType(), rm_MinorCol::SelectByMajCol(), rm_MediumVol::SelectByMajColId(), rm_MediumVol::SelectByMedium(), rm_MediumVol::SelectByMedVolId(), rm_Partition::SelectByName(), rm_MediaPool::SelectByName(), rm_DiskSubsys::SelectByName(), rm_Drive::SelectByName(), rm_Library::SelectByName(), rm_MediumVol::SelectByPartition(), rm_Medium::SelectByPartition(), rm_Medium::SelectBySlot(), rm_Medium::SelectByStatus(), rm_Drive::SelectByStatus(), rm_Partition::SelectByUuid(), rm_MediaPool::SelectByUUID(), rm_ColMediaVol::SelectByVolume(), rm_MediumVol::SelectEmptyCollocation(), rm_Drive::SelectForOperation(), rm_Operator::SelectMediumForMig(), rm_Operator::SelectMediumVolumeCol(), rm_Operator::SelectMediumVolumeMig(), rm_ColMediaVol::StartSelectAll(), rm_MinorCol::StartSelectAll(), rm_MajorCol::StartSelectAll(), rm_Partition::StartSelectAll(), rm_MediumVol::StartSelectAll(), rm_Medium::StartSelectAll(), rm_Slot::StartSelectAll(), rm_MediaPool::StartSelectAll(), rm_DiskSubsys::StartSelectAll(), and rm_DriveHost::StartSelectAll().

#define SQL_NOTFOUND   (SQL_100)
#define SQL_UNIQUEVIOLATION   (-803)

Typedef Documentation

Definition at line 878 of file rmdb.h.

Definition at line 482 of file rmdb.h.


Function Documentation

int FB_shutdownCallback ( const int  reason,
const int  mask,
void *  arg 
)

Definition at line 320 of file librmdb.exx.

References dbg_LOW, FB_shutdownCallback(), g_ShutdownPermitted, log_DBG_m, log_FUNC_m, and cmn_Semaphore::Wait().

Referenced by FB_shutdownCallback(), and rm_DB::rm_DB().

                                                                    {
    log_FUNC_m(FB_shutdownCallback);
    int rc = 0;
    // Do not terminate on SIGTERM or SIGINT
    if (mask == fb_shut_preproviders && reason == fb_shutrsn_signal) {
        g_ShutdownPermitted.Wait();
        rc = 1; // do not shut down
    }
    log_DBG_m(dbg_LOW, "***** Reason = " <<  reason <<  " mask = 0x" << hex << mask << " *****  returning " << rc  );
    return rc; 
}

Here is the call graph for this function:

Here is the caller graph for this function:

static long int isc_dsql_execute_m ( long int *  a_statusVector,
void **  a_dbHandle,
void **  a_trHandle,
short unsigned int  a_stmtLength,
char *  a_stmt,
int  a_6,
short unsigned int  a_7,
char *  a_xsqlda 
) [static]

Definition at line 763 of file rmdb.h.

                                                   {

    return ::isc_dsql_execute_m(    reinterpret_cast<ISC_STATUS *>(a_statusVector),
                                    a_dbHandle,
                                    a_trHandle,
                                    a_stmtLength,
                                    const_cast<ISC_SCHAR *>(a_stmt),
                                    static_cast<short unsigned int>(a_6),
                                    a_7,
                                    static_cast<ISC_SCHAR *>(a_xsqlda));


}

void TableExists ( char  [IB_TABLE_NAME_SIZE]  ) 

Definition at line 334 of file librmdb.exx.

References dbg_LOW, errorDesc(), ie_RMDB_ERROR, ivd_Error, log_DBG_m, log_FUNC_m, NAME, SQL_CHECKREAD_M, str, and TableExists().

Referenced by rm_DB::Check(), and TableExists().

                                                       {
    log_FUNC_m(TableExists);

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

    int count(0);
    EXEC SQL
        SELECT TRANSACTION readTrans
        COUNT(*)
    INTO :count
        FROM RDB$RELATIONS
        WHERE RDB$RELATION_NAME = :a_tablename;

    string sqlErrDesc = errorDesc(SQLCODE, "Table exsist");
    SQL_CHECKREAD_M( sqlErrDesc );
    log_DBG_m(dbg_LOW, "Count:" << count);
    if (count == 1 ) {
        log_DBG_m(dbg_LOW, " OK a_tablename:" << a_tablename );
    }
    else {
        ostringstream str;
        str << "Table missing in rmdb: " << a_tablename;
        log_DBG_m(dbg_LOW, str.str());
        throw ivd_Error(ie_RMDB_ERROR, str.str());
    }
}//TableExists

Here is the call graph for this function:

Here is the caller graph for this function: