Skip to content

Commit

Permalink
[irods#6953] Deprecate BACKUP_RESC_NAME_KW
Browse files Browse the repository at this point in the history
Nothing is actually deprecated for compiling because everything
is either a macro or a hard-coded string. This commit leaves comments
wherever the backupResc feature is being acknowledged in order to
notify the reader the feature is deprecated.
  • Loading branch information
alanking committed Mar 27, 2024
1 parent 207a1f5 commit e143d54
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 18 deletions.
2 changes: 1 addition & 1 deletion lib/api/include/irods/dataObjRepl.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* DEST_RESC_NAME_KW - "value" = The destination Resource.
* ADMIN_KW - Admin removing other users' files. Only files
* in trash can be removed.
* BACKUP_RESC_NAME_KW - backup resource (backup mode).
* BACKUP_RESC_NAME_KW - (Deprecated) backup resource (backup mode).
* return value - The status of the operation.
*/
#ifdef __cplusplus
Expand Down
2 changes: 1 addition & 1 deletion lib/api/src/rcDataObjRepl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
* \n REPL_NUM_KW - The replica number of the copy to be used as source.
* \n RESC_NAME_KW - The copy stored in this resource to be used as source.
* \n DEST_RESC_NAME_KW - The resource to store the new replica.
* \n BACKUP_RESC_NAME_KW - The resource to store the new replica.
* \n BACKUP_RESC_NAME_KW - (Deprecated) The resource to store the new replica.
* In backup mode. If a good copy already exists in this
* resource, don't make another one.
* \n ADMIN_KW - admin user backup/replicate other user's files.
Expand Down
1 change: 1 addition & 0 deletions lib/core/include/irods/msParam.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ typedef struct ValidKeyWd {

#define RESC_NAME_FLAG 0x1
#define DEST_RESC_NAME_FLAG 0x2
// BACKUP_RESC_NAME has been deprecated.
#define BACKUP_RESC_NAME_FLAG 0x4
#define FORCE_FLAG_FLAG 0x8
#define ALL_FLAG 0x10
Expand Down
2 changes: 2 additions & 0 deletions lib/core/include/irods/objInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ typedef struct DataObjInfo {
int dataAccessInx;
int writeFlag;
char destRescName[NAME_LEN];
// The backupResc feature has been deprecated and will be removed in a future release. It is not being marked as
// deprecated for compilation purposes because we cannot change this struct and it is used everywhere.
char backupRescName[NAME_LEN];
char subPath[MAX_NAME_LEN];
specColl_t *specColl;
Expand Down
1 change: 1 addition & 0 deletions lib/core/include/irods/parseCommandLine.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ typedef struct RodsArguments {
int noattr;
char *attrStr;
int bulk;
// backupMode has been deprecated and will be removed in a future release.
int backupMode;
int condition;
char *conditionString;
Expand Down
1 change: 1 addition & 0 deletions lib/core/include/irods/rodsKeyWdDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define RESC_NAME_KW "rescName" /* resource name */
#define DEST_RESC_NAME_KW "destRescName" /* destination resource name */
#define DEF_RESC_NAME_KW "defRescName" /* default resource name */
// BACKUP_RESC_NAME has been deprecated.
#define BACKUP_RESC_NAME_KW "backupRescName" /* destination resource name */
#define LEAF_RESOURCE_NAME_KW "leafRescName"
#define DATA_TYPE_KW "dataType" /* data type */
Expand Down
1 change: 1 addition & 0 deletions lib/core/src/replUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ initCondForRepl( rodsEnv *myRodsEnv, rodsArguments_t *rodsArgs,
myRodsEnv->rodsDefResource );
}

// The BACKUP_RESC_NAME feature has been deprecated and will be removed in a future release.
if ( myResc != NULL && rodsArgs->backupMode == True ) {
addKeyVal( &dataObjInp->condInput, BACKUP_RESC_NAME_KW,
myResc );
Expand Down
1 change: 1 addition & 0 deletions packaging/core.dvm.template
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ collId||rei->doi->collId
statusString||rei->doi->statusString
# dataMapId||rei->doi->dataMapId
destRescName||rei->doi->destRescName
# The backupRescName feature has been deprecated and will be removed in a future release.
backupRescName||rei->doi->backupRescName
rescName||rei->doi->rescName
# user info coming directly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ int getValFromDataObjInfo( char *varMap, dataObjInfo_t *rei, Res **varValue, Reg
return i;
}


// The backupResc feature has been deprecated and will be removed in a future release.
if ( strcmp( varName, "backupRescName" ) == 0 ) {

i = getStrLeafValue( varValue, rei->backupRescName, r );
Expand Down Expand Up @@ -991,6 +991,7 @@ int setValFromDataObjInfo( char *varMap, dataObjInfo_t **inrei, Res *newVarValue
return i;
}

// The backupResc feature has been deprecated and will be removed in a future release.
if ( strcmp( varName, "backupRescName" ) == 0 ) {

i = setStrLeafValue( rei->backupRescName, NAME_LEN, newVarValue );
Expand Down Expand Up @@ -1233,7 +1234,7 @@ ExprType *getVarTypeFromDataObjInfo( char *varMap, Region *r ) {

}


// The backupResc feature has been deprecated and will be removed in a future release.
if ( strcmp( varName, "backupRescName" ) == 0 ) {

return newSimpType( T_STRING, r );
Expand Down
2 changes: 2 additions & 0 deletions server/api/src/rsChkObjPermAndStat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ chkCollForBundleOpr( rsComm_t *rsComm,
auto cond_input = irods::experimental::make_key_value_proxy(data_obj_inp.condInput);
irods::at_scope_exit free_kvp{ [&data_obj_inp] { clearKeyVal(&data_obj_inp.condInput); } };

// The BACKUP_RESC_NAME feature has been deprecated and will be removed in a future release.
cond_input[BACKUP_RESC_NAME_KW] = resource;
cond_input[RESC_HIER_STR_KW] = curCollEnt->resc_hier;
cond_input[DEST_RESC_HIER_STR_KW] = resc_hier;
Expand Down Expand Up @@ -261,6 +262,7 @@ chkCollForBundleOpr( rsComm_t *rsComm,
auto cond_input = irods::experimental::make_key_value_proxy(data_obj_inp.condInput);
irods::at_scope_exit free_kvp{ [&data_obj_inp] { clearKeyVal(&data_obj_inp.condInput); } };

// The BACKUP_RESC_NAME feature has been deprecated and will be removed in a future release.
cond_input[BACKUP_RESC_NAME_KW] = resource;
cond_input[RESC_HIER_STR_KW] = curCollEnt->resc_hier;
cond_input[DEST_RESC_HIER_STR_KW] = resc_hier;
Expand Down
2 changes: 2 additions & 0 deletions server/core/src/irods_resource_backport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ namespace irods {
}
else if ( _cond_input ) {
char* name = NULL;
// The BACKUP_RESC_NAME feature has been deprecated and will be removed in a future release.
if ( ( name = getValByKey( _cond_input, BACKUP_RESC_NAME_KW ) ) == NULL &&
( name = getValByKey( _cond_input, DEST_RESC_NAME_KW ) ) == NULL &&
( name = getValByKey( _cond_input, DEF_RESC_NAME_KW ) ) == NULL &&
Expand Down Expand Up @@ -435,6 +436,7 @@ namespace irods {
std::string& _out ) {
if ( _resc_name.empty() ) {
char* name = 0;
// The BACKUP_RESC_NAME feature has been deprecated and will be removed in a future release.
name = getValByKey( _cond_input, BACKUP_RESC_NAME_KW );
if ( name ) {
_out = std::string( name );
Expand Down
1 change: 1 addition & 0 deletions server/core/src/irods_resource_redirect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ namespace
if (dest_resc_name) {
key_word = dest_resc_name;
}
// The BACKUP_RESC_NAME feature has been deprecated and will be removed in a future release.
char* backup_resc_name = getValByKey(&_data_obj_inp.condInput, BACKUP_RESC_NAME_KW);
if (backup_resc_name) {
key_word = backup_resc_name;
Expand Down
27 changes: 13 additions & 14 deletions server/re/src/reDataObjOpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ msiDataObjUnlink( msParam_t *inpParam, msParam_t *outParam,
* compatibility.
* Valid keyWds are:
* \li "destRescName" - the target resource to replicate to.
* \li "backupRescName" - the target resource to backup
* \li "backupRescName" - (Deprecated) the target resource to backup
* the data. If this keyWd is used, the backup mode
* will be switched on.
* \li "rescName" - the resource of the source copy.
Expand Down Expand Up @@ -957,7 +957,7 @@ msiDataObjUnlink( msParam_t *inpParam, msParam_t *outParam,
* \pre none
* \post none
* \sa none
**/
**/
int
msiDataObjRepl( msParam_t *inpParam1, msParam_t *msKeyValStr,
msParam_t *outParam, ruleExecInfo_t *rei ) {
Expand Down Expand Up @@ -993,11 +993,11 @@ msiDataObjRepl( msParam_t *inpParam1, msParam_t *msKeyValStr,
return rei->status;
}

validKwFlags = OBJ_PATH_FLAG | DEST_RESC_NAME_FLAG | NUM_THREADS_FLAG |
BACKUP_RESC_NAME_FLAG | RESC_NAME_FLAG | UPDATE_REPL_FLAG |
REPL_NUM_FLAG | ALL_FLAG | ADMIN_FLAG | VERIFY_CHKSUM_FLAG |
RBUDP_TRANSFER_FLAG | RBUDP_SEND_RATE_FLAG | RBUDP_PACK_SIZE_FLAG |
FORCE_CHKSUM_FLAG;
validKwFlags = OBJ_PATH_FLAG | DEST_RESC_NAME_FLAG | NUM_THREADS_FLAG | RESC_NAME_FLAG | UPDATE_REPL_FLAG |
REPL_NUM_FLAG | ALL_FLAG | ADMIN_FLAG | VERIFY_CHKSUM_FLAG | RBUDP_TRANSFER_FLAG |
RBUDP_SEND_RATE_FLAG | RBUDP_PACK_SIZE_FLAG | FORCE_CHKSUM_FLAG;
// The BACKUP_RESC_NAME feature has been deprecated and will be removed in a future version.
validKwFlags |= BACKUP_RESC_NAME_FLAG;
rei->status = parseMsKeyValStrForDataObjInp( msKeyValStr, myDataObjInp,
DEST_RESC_NAME_KW, validKwFlags, &outBadKeyWd );

Expand Down Expand Up @@ -2834,7 +2834,6 @@ msiExecCmd( msParam_t *inpParam1, msParam_t *inpParam2, msParam_t *inpParam3,
return rei->status;
}


/**
* \fn msiCollRepl (msParam_t *collection, msParam_t *msKeyValStr, msParam_t *status,
* ruleExecInfo_t *rei)
Expand All @@ -2860,7 +2859,7 @@ msiExecCmd( msParam_t *inpParam1, msParam_t *inpParam2, msParam_t *inpParam3,
* compatibility.
* Valid keyWds are:
* \li "destRescName" - the target resource to replicate to.
* \li "backupRescName" - the target resource to backup
* \li "backupRescName" - (Deprecated) the target resource to backup
* the data. If this keyWd is used, the backup mode
* will be switched on.
* \li "rescName" - the resource of the source copy.
Expand Down Expand Up @@ -2899,7 +2898,7 @@ msiExecCmd( msParam_t *inpParam1, msParam_t *inpParam2, msParam_t *inpParam3,
* \pre none
* \post none
* \sa none
**/
**/
int
msiCollRepl( msParam_t *collection, msParam_t *msKeyValStr, msParam_t *status,
ruleExecInfo_t *rei ) {
Expand Down Expand Up @@ -2939,10 +2938,10 @@ msiCollRepl( msParam_t *collection, msParam_t *msKeyValStr, msParam_t *status,


/* Parse resource name and directly write to collReplInp */
validKwFlags = COLL_NAME_FLAG | DEST_RESC_NAME_FLAG |
BACKUP_RESC_NAME_FLAG | RESC_NAME_FLAG | UPDATE_REPL_FLAG |
REPL_NUM_FLAG | ALL_FLAG | ADMIN_FLAG | VERIFY_CHKSUM_FLAG |
FORCE_CHKSUM_FLAG;
validKwFlags = COLL_NAME_FLAG | DEST_RESC_NAME_FLAG | RESC_NAME_FLAG | UPDATE_REPL_FLAG | REPL_NUM_FLAG | ALL_FLAG |
ADMIN_FLAG | VERIFY_CHKSUM_FLAG | FORCE_CHKSUM_FLAG;
// The BACKUP_RESC_NAME feature has been deprecated and will be removed in a future version.
validKwFlags |= BACKUP_RESC_NAME_FLAG;
rei->status = parseMsKeyValStrForCollInp( msKeyValStr, collInp,
DEST_RESC_NAME_KW, validKwFlags, &outBadKeyWd );

Expand Down

0 comments on commit e143d54

Please sign in to comment.