irods  4.2.8
About: iRODS (the integrated Rule Oriented Data System) is a distributed data-management system for creating data grids, digital libraries, persistent archives, and real-time data systems.
  Fossies Dox: irods-4.2.8.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

nre.systemMS.cpp File Reference
#include <string.h>
#include <time.h>
#include "rsRuleExecSubmit.hpp"
#include "icatHighLevelRoutines.hpp"
#include "rcMisc.h"
#include "execMyRule.h"
#include "region.h"
#include "irods_plugin_name_generator.hpp"
#include "irods_load_plugin.hpp"
#include "sockComm.h"
#include "rsRuleExecDel.hpp"
#include "ruleExecDel.h"
#include "rsExecMyRule.hpp"
#include "irods_server_properties.hpp"
#include "irods_log.hpp"
#include "irods_re_structs.hpp"
#include "irods_ms_plugin.hpp"
#include <string>
#include <vector>
Include dependency graph for nre.systemMS.cpp:

Go to the source code of this file.

Functions

int checkFilePerms (char *fileName)
 
int fillSubmitConditions (const char *action, const char *inDelayCondition, bytesBuf_t *packedReiAndArgBBuf, ruleExecSubmitInp_t *ruleSubmitInfo, ruleExecInfo_t *rei)
 
int _delayExec (const char *, const char *, const char *, ruleExecInfo_t *)
 
int delayExec (msParam_t *mPA, msParam_t *mPB, msParam_t *mPC, ruleExecInfo_t *rei)
 
std::map< std::string, std::vector< std::string > > getTaggedValues (const char *str)
 
void set_plugin_instance_name (const char *_xml, char *_plugin_name)
 
int recover_delayExec (msParam_t *, msParam_t *, ruleExecInfo_t *rei)
 
static int carryOverMsParam (msParamArray_t *sourceMsParamArray, msParamArray_t *targetMsParamArray)
 
int remoteExec (msParam_t *mPD, msParam_t *mPA, msParam_t *mPB, msParam_t *mPC, ruleExecInfo_t *rei)
 
int recover_remoteExec (msParam_t *, msParam_t *, char *, ruleExecInfo_t *rei)
 
int doForkExec (char *prog, char *arg1)
 
int msiGoodFailure (ruleExecInfo_t *)
 
int msiFreeBuffer (msParam_t *memoryParam, ruleExecInfo_t *rei)
 
int msiSleep (msParam_t *secPtr, msParam_t *microsecPtr, ruleExecInfo_t *)
 
int msiGetDiffTime (msParam_t *inpParam1, msParam_t *inpParam2, msParam_t *inpParam3, msParam_t *outParam, ruleExecInfo_t *rei)
 
int msiGetSystemTime (msParam_t *outParam, msParam_t *inpParam, ruleExecInfo_t *rei)
 
int msiHumanToSystemTime (msParam_t *inpParam, msParam_t *outParam, ruleExecInfo_t *rei)
 
int msiStrToBytesBuf (msParam_t *str_msp, msParam_t *buf_msp, ruleExecInfo_t *)
 
int msiBytesBufToStr (msParam_t *buf_msp, msParam_t *str_msp, ruleExecInfo_t *)
 
int msiListEnabledMS (msParam_t *outKVPairs, ruleExecInfo_t *rei)
 
int msiGetFormattedSystemTime (msParam_t *outParam, msParam_t *inpParam, msParam_t *inpFormatParam, ruleExecInfo_t *rei)
 

Variables

static std::vector< std::string > GlobalDelayExecStack
 

Function Documentation

◆ _delayExec()

int _delayExec ( const char *  inActionCall,
const char *  recoveryActionCall,
const char *  delayCondition,
ruleExecInfo_t rei 
)

Definition at line 158 of file nre.systemMS.cpp.

References clearBBuf(), fillSubmitConditions(), GlobalDelayExecStack, MAX_NUM_OF_ARGS_IN_ACTION, NULL, packReiAndArg(), RuleExecInfo::pluginInstanceName, RE_TEST_MACRO, RuleExecInfo::rsComm, rsRuleExecSubmit(), and set_plugin_instance_name().

Referenced by delayExec(), exec_rule_text(), and smsi_delayExec().

Here is the call graph for this function:

◆ carryOverMsParam()

static int carryOverMsParam ( msParamArray_t sourceMsParamArray,
msParamArray_t targetMsParamArray 
)
static

Definition at line 232 of file nre.systemMS.cpp.

References addMsParamToArray(), getMsParamByLabel(), MsParam::inOutStruct, MsParam::inpOutBuf, MsParam::label, MsParamArray::len, LOG_ERROR, MsParamArray::msParam, NULL, replBytesBuf(), replInOutStruct(), rodsLogError(), irods.pypyodbc::status, and MsParam::type.

Referenced by remoteExec().

Here is the call graph for this function:

◆ checkFilePerms()

int checkFilePerms ( char *  fileName)

Definition at line 444 of file nre.systemMS.cpp.

References buf.

Referenced by doForkExec().

◆ delayExec()

int delayExec ( msParam_t mPA,
msParam_t mPB,
msParam_t mPC,
ruleExecInfo_t rei 
)

Definition at line 111 of file nre.systemMS.cpp.

References _delayExec(), MsParam::inOutStruct, MAX_ACTION_SIZE, and rstrcpy().

Referenced by irods::lookup_table< resource_ptr >::lookup_table().

Here is the call graph for this function:

◆ doForkExec()

int doForkExec ( char *  prog,
char *  arg1 
)

Definition at line 364 of file nre.systemMS.cpp.

References checkFilePerms(), and pid_age::pid.

Here is the call graph for this function:

◆ fillSubmitConditions()

◆ getTaggedValues()

std::map<std::string, std::vector<std::string> > getTaggedValues ( const char *  str)

Definition at line 462 of file irods_re_structs.cpp.

References INPUT_ARG_NOT_WELL_FORMED_ERR, and THROW.

Referenced by fillSubmitConditions(), and set_plugin_instance_name().

◆ msiBytesBufToStr()

int msiBytesBufToStr ( msParam_t buf_msp,
msParam_t str_msp,
ruleExecInfo_t  
)
Description:\n Writes a bytesBuf_t into a character string
Module:\n core
Since
3.3
Remarks
This may blow up if the buffer is not a character string. so be careful
Note
The string can have length up to BUF_LEN_MS_T
Example Usage:\n

testrule{ msiBytesBufToStr(*Buff, *St) writeLine(stdout,*St) } ruleExecOut

Parameters
[in]buf_msp- a BUF_LEN_MS_T
[out]str_msp- a STR_MS_T
[in,out]-The RuleExecInfo structure that is automatically handled by the rule engine. The user does not include rei as a parameter in the rule invocation.
Session Variables Used:\n none
Session Variables Modified:\n none
iCAT Attributes Used:\n none
iCAT Attributes Modified:\n none
Side Effect:\n none
Returns
integer
Return values
0on success
Precondition
none
Postcondition
none
See also
none

Definition at line 900 of file nre.systemMS.cpp.

References BytesBuf::buf, irods::CFG_MAX_SIZE_FOR_SINGLE_BUFFER(), terminate_irods_processes::e, fillStrInMsParam(), MsParam::inOutStruct, MsParam::inpOutBuf, BytesBuf::len, irods::log(), LOG_ERROR, NULL, rodsLog(), USER__NULL_INPUT_ERR, and USER_INPUT_FORMAT_ERR.

Referenced by irods::lookup_table< resource_ptr >::lookup_table().

Here is the call graph for this function:

◆ msiFreeBuffer()

int msiFreeBuffer ( msParam_t memoryParam,
ruleExecInfo_t rei 
)
Description:\n This microservice frees a named buffer, including stdout and stderr
Module:\n core
Since
pre-2.1
Example Usage:\n See clients/icommands/test/rules/
Parameters
[in]memoryParam- the buffer to free
[in,out]rei- The RuleExecInfo structure that is automatically handled by the rule engine. The user does not include rei as a parameter in the rule invocation.
Session Variables Used:\n none
Session Variables Modified:\n none
iCAT Attributes Used:\n none
iCAT Attributes Modified:\n none
Side Effect:\n none
Returns
integer
Return values
0on success
Precondition
none
Postcondition
none
See also
none

Definition at line 490 of file nre.systemMS.cpp.

References BytesBuf::buf, getMsParamByLabel(), MsParam::inOutStruct, MsParam::inpOutBuf, BytesBuf::len, RuleExecInfo::msParamArray, NULL, RE_TEST_MACRO, ExecCmdOut::stderrBuf, ExecCmdOut::stdoutBuf, and MsParam::type.

Referenced by irods::lookup_table< resource_ptr >::lookup_table().

Here is the call graph for this function:

◆ msiGetDiffTime()

int msiGetDiffTime ( msParam_t inpParam1,
msParam_t inpParam2,
msParam_t inpParam3,
msParam_t outParam,
ruleExecInfo_t rei 
)
Description:\n This microservice returns the difference between two system times
Module:\n framework
Since
2.1
Note
If we have arithmetic MSs in the future we should use DOUBLE_MS_T instead of strings. Default output format is in seconds, use 'human' as the third input param for human readable format.
Example Usage:\n See clients/icommands/test/rules/
Parameters
[in]inpParam1- a STR_MS_T containing the start date (system time in seconds)
[in]inpParam2- a STR_MS_T containing the end date (system time in seconds)
[in]inpParam3- Optional - a STR_MS_T containing the desired output format
[out]outParam- a STR_MS_T containing the time elapsed between the two dates
[in,out]rei- The RuleExecInfo structure that is automatically handled by the rule engine. The user does not include rei as a parameter in the rule invocation.
Session Variables Used:\n none
Session Variables Modified:\n none
iCAT Attributes Used:\n none
iCAT Attributes Modified:\n none
Side Effect:\n none
Returns
integer
Return values
0on success
Precondition
none
Postcondition
none
See also
none

Definition at line 611 of file nre.systemMS.cpp.

References fillStrInMsParam(), MsParam::inOutStruct, LOG_ERROR, NULL, parseMspForStr(), RE_TEST_MACRO, rodsLog(), RuleExecInfo::rsComm, SYS_INTERNAL_NULL_INPUT_ERR, TIME_LEN, and USER__NULL_INPUT_ERR.

Referenced by irods::lookup_table< resource_ptr >::lookup_table().

Here is the call graph for this function:

◆ msiGetFormattedSystemTime()

int msiGetFormattedSystemTime ( msParam_t outParam,
msParam_t inpParam,
msParam_t inpFormatParam,
ruleExecInfo_t rei 
)
Description:\n Returns the local system time, formatted
Module:\n core
Since
pre-2.1
Note
Default output format is system time in seconds. Use 'human' as input parameter for human readable format.
Example Usage:\n See clients/icommands/test/rules/
Parameters
[out]outParam- a STR_MS_T containing the time
[in]inpParam- Optional - a STR_MS_T containing the desired output format (human)
[in]inpFormatParam- Optional - a STR_MS_T containing printf formatting (if inpParam was human)
[in,out]rei- The RuleExecInfo structure that is automatically handled by the rule engine. The user does not include rei as a parameter in the rule invocation.
Session Variables Used:\n none
Session Variables Modified:\n none
iCAT Attributes Used:\n none
iCAT Attributes Modified:\n none
Side Effect:\n none
Returns
integer
Return values
0on success
Precondition
none
Postcondition
none
See also
none

Definition at line 1059 of file nre.systemMS.cpp.

References fillStrInMsParam(), getNowStr(), MsParam::inOutStruct, LOG_ERROR, NULL, RE_TEST_MACRO, rodsLog(), RuleExecInfo::rsComm, SYS_INTERNAL_NULL_INPUT_ERR, and TIME_LEN.

Referenced by irods::lookup_table< resource_ptr >::lookup_table().

Here is the call graph for this function:

◆ msiGetSystemTime()

int msiGetSystemTime ( msParam_t outParam,
msParam_t inpParam,
ruleExecInfo_t rei 
)
Description:\n This microservice returns the local system time
Module:\n framework
Since
pre-2.1
Note
Default output format is system time in seconds, use 'human' as input param for human readable format.
Example Usage:\n See clients/icommands/test/rules/
Parameters
[out]outParam- a STR_MS_T containing the time
[in]inpParam- Optional - a STR_MS_T containing the desired output format
[in,out]rei- The RuleExecInfo structure that is automatically handled by the rule engine. The user does not include rei as a parameter in the rule invocation.
Session Variables Used:\n none
Session Variables Modified:\n none
iCAT Attributes Used:\n none
iCAT Attributes Modified:\n none
Side Effect:\n none
Returns
integer
Return values
0on success
Precondition
none
Postcondition
none
See also
none

Definition at line 701 of file nre.systemMS.cpp.

References fillStrInMsParam(), getLocalTimeFromRodsTime(), getNowStr(), MsParam::inOutStruct, LOG_ERROR, NULL, RE_TEST_MACRO, rodsLog(), RuleExecInfo::rsComm, SYS_INTERNAL_NULL_INPUT_ERR, and TIME_LEN.

Referenced by irods::lookup_table< resource_ptr >::lookup_table().

Here is the call graph for this function:

◆ msiGoodFailure()

int msiGoodFailure ( ruleExecInfo_t )
Description:\n This microservice fails on purpose.
Module:\n core
Since
pre-2.1
Note
This microservice performs no operations but fails the current rule application immediately even if the body still has some more microservices. But other definitions of the rule are not retried upon this failure. It is useful when you want to fail but no recovery initiated.
Example Usage:\n See clients/icommands/test/rules/
Session Variables Used:\n none
Session Variables Modified:\n none
iCAT Attributes Used:\n none
iCAT Attributes Modified:\n none
Side Effect:\n none
Returns
integer
Return values
negativenumber
Precondition
none
Postcondition
none
See also
fail

Definition at line 436 of file nre.systemMS.cpp.

References RETRY_WITHOUT_RECOVERY_ERR.

Referenced by irods::lookup_table< resource_ptr >::lookup_table().

◆ msiHumanToSystemTime()

int msiHumanToSystemTime ( msParam_t inpParam,
msParam_t outParam,
ruleExecInfo_t rei 
)
Description:\n Converts a human readable date to a system timestamp
Module:\n framework
Since
pre-2.1
Note
Expects an input date in the form: YYYY-MM-DD-hh.mm.ss
Example Usage:\n See clients/icommands/test/rules/
Parameters
[in]inpParam- a STR_MS_T containing the input date
[out]outParam- a STR_MS_T containing the timestamp
[in,out]rei- The RuleExecInfo structure that is automatically handled by the rule engine. The user does not include rei as a parameter in the rule invocation.
Session Variables Used:\n none
Session Variables Modified:\n none
iCAT Attributes Used:\n none
iCAT Attributes Modified:\n none
Side Effect:\n none
Returns
integer
Return values
0on success
Precondition
none
Postcondition
none
See also
none

Definition at line 764 of file nre.systemMS.cpp.

References fillStrInMsParam(), localToUnixTime(), LOG_ERROR, NULL, parseMspForStr(), RE_TEST_MACRO, rodsLog(), RuleExecInfo::rsComm, RuleExecInfo::status, SYS_INTERNAL_NULL_INPUT_ERR, and TIME_LEN.

Referenced by irods::lookup_table< resource_ptr >::lookup_table().

Here is the call graph for this function:

◆ msiListEnabledMS()

int msiListEnabledMS ( msParam_t outKVPairs,
ruleExecInfo_t rei 
)
Description:\n Returns the list of compiled microservices on the local iRODS server
Module:\n framework
Since
2.1
Note
This microservice looks at reAction.hpp and returns the list of compiled microservices on the local iRODS server. The results are written to a KeyValPair_MS_T. For each pair the keyword is the MS name while the value is the module where the microservice belongs. Standard non-module microservices are listed as "core".
Example Usage:\n See clients/icommands/test/rules/
Parameters
[out]outKVPairs- A KeyValPair_MS_T containing the results.
[in,out]rei- The RuleExecInfo structure that is automatically handled by the rule engine. The user does not include rei as a parameter in the rule invocation.
Session Variables Used:\n none
Session Variables Modified:\n none
iCAT Attributes Used:\n none
iCAT Attributes Modified:\n none
Side Effect:\n none
Returns
integer
Return values
0on success
Precondition
none
Postcondition
none
See also
none

Definition at line 966 of file nre.systemMS.cpp.

References addKeyVal(), irods::lookup_table< ValueType, KeyType, HashType >::begin(), irods::error::code(), irods::lookup_table< ValueType, KeyType, HashType >::end(), fillMsParam(), KeyValPair_MS_T, irods::plugin_name_generator::list_plugins(), irods::log(), LOG_ERROR, NULL, irods::error::ok(), PASS, irods::PLUGIN_TYPE_MICROSERVICE(), RE_TEST_MACRO, irods::resolve_plugin_path(), run_tests::results, rodsLog(), RuleExecInfo::rsComm, and SYS_INTERNAL_NULL_INPUT_ERR.

Referenced by irods::lookup_table< resource_ptr >::lookup_table().

Here is the call graph for this function:

◆ msiSleep()

int msiSleep ( msParam_t secPtr,
msParam_t microsecPtr,
ruleExecInfo_t  
)
Description:\n Sleep for some amount of time
Module:\n core
Since
pre-2.1
Example Usage:\n See clients/icommands/test/rules/
Parameters
[in]secPtr- secPtr is a msParam of type STR_MS_T which is seconds
[in]microsecPtr- microsecPrt is a msParam of type STR_MS_T which is microseconds
[in,out]-The RuleExecInfo structure that is automatically handled by the rule engine. The user does not include rei as a parameter in the rule invocation.
Session Variables Used:\n none
Session Variables Modified:\n none
iCAT Attributes Used:\n none
iCAT Attributes Modified:\n none
Side Effect:\n none
Returns
integer
Return values
0on success
Precondition
none
Postcondition
none
See also
none

Definition at line 564 of file nre.systemMS.cpp.

References MsParam::inOutStruct, and rodsSleep().

Referenced by irods::lookup_table< resource_ptr >::lookup_table().

Here is the call graph for this function:

◆ msiStrToBytesBuf()

int msiStrToBytesBuf ( msParam_t str_msp,
msParam_t buf_msp,
ruleExecInfo_t  
)
Description:\n Converts a string to a bytesBuf_t
Module:\n core
Since
pre-2.1
Note
For easily passing parameters to microservices that require a BUF_LEN_MS_T
Example Usage:\n See clients/icommands/test/rules/
Parameters
[in]str_msp- a STR_MS_T
[out]buf_msp- a BUF_LEN_MS_T
[in,out]-The RuleExecInfo structure that is automatically handled by the rule engine. The user does not include rei as a parameter in the rule invocation.
Session Variables Used:\n none
Session Variables Modified:\n none
iCAT Attributes Used:\n none
iCAT Attributes Modified:\n none
Side Effect:\n none
Returns
integer
Return values
0on success
Precondition
none
Postcondition
none
See also
none

Definition at line 835 of file nre.systemMS.cpp.

References BytesBuf::buf, fillBufLenInMsParam(), BytesBuf::len, LOG_ERROR, NULL, parseMspForStr(), rodsLog(), and USER__NULL_INPUT_ERR.

Referenced by irods::lookup_table< resource_ptr >::lookup_table().

Here is the call graph for this function:

◆ recover_delayExec()

int recover_delayExec ( msParam_t ,
msParam_t ,
ruleExecInfo_t rei 
)

Definition at line 205 of file nre.systemMS.cpp.

References GlobalDelayExecStack, LOG_ERROR, rodsLog(), RuleExecInfo::rsComm, rsRuleExecDel(), ruleExecDelInp_t::ruleExecId, and SYS_INTERNAL_NULL_INPUT_ERR.

Here is the call graph for this function:

◆ recover_remoteExec()

int recover_remoteExec ( msParam_t ,
msParam_t ,
char *  ,
ruleExecInfo_t rei 
)

Definition at line 338 of file nre.systemMS.cpp.

References GlobalDelayExecStack, LOG_ERROR, RE_TEST_MACRO, rodsLog(), ruleExecDelInp_t::ruleExecId, and SYS_INTERNAL_NULL_INPUT_ERR.

Here is the call graph for this function:

◆ remoteExec()

◆ set_plugin_instance_name()

void set_plugin_instance_name ( const char *  _xml,
char *  _plugin_name 
)

Definition at line 138 of file nre.systemMS.cpp.

References terminate_irods_processes::e, getTaggedValues(), irods::log(), MAX_NAME_LEN, and rstrcpy().

Referenced by _delayExec().

Here is the call graph for this function:

Variable Documentation

◆ GlobalDelayExecStack

std::vector<std::string> GlobalDelayExecStack
static

Definition at line 28 of file nre.systemMS.cpp.

Referenced by _delayExec(), recover_delayExec(), and recover_remoteExec().