Skip to content

Commit

Permalink
YDA-6065: update core.re for iRODS 4.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
lwesterhof committed Dec 12, 2024
1 parent 4732fcd commit 08b4d02
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 194 deletions.
114 changes: 17 additions & 97 deletions docker/images/yoda_irods_icat/core.re.template
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
# iRODS Rule Base
# The new rule language is used to express all policies
# Recovery procedures are included for a micro-service after " ::: "
# iRODS core.re Rule Base
#
#Test Rules
printHello { print_hello; }

#
#
# These are sys admin rules for creating and deleting users and renaming
# the local zone.
acPreConnect(*OUT) { *OUT="CS_NEG_DONT_CARE"; }
# Defines the SSL (client-server negotiation) policy for this server
# - CS_NEG_REFUSE - No SSL
# - CS_NEG_DONT_CARE - Depends on the Client request
# - CS_NEG_REQUIRE - Require SSL
acPreConnect(*OUT) { *OUT="CS_NEG_REFUSE"; }

acCreateUser {
acPreProcForCreateUser;
Expand Down Expand Up @@ -120,34 +115,34 @@ acCheckPasswordStrength(*password) { }
# The following are rules for data object operation
# Note that the msiOprDisallowed microservice can be used by all the rules
# to disallow the execution of certain actions.
# 1) acSetRescSchemeForCreate - This is the preprossing rule for creating a
# 1) acSetRescSchemeForCreate - This is the preprocessing rule for creating a
# data object. It can be used for setting the resource selection scheme
# when creating a data object which is used by the put, copy and
# replicate operations. Currently, three preprocessing functions can be
# when creating a data object which is used by the put, copy, and
# replication operations. Currently, three preprocessing functions can be
# used by this rule:
# msiSetNoDirectRescInp(rescList) - sets a list of resources that cannot
# be used by a normal user directly. More than one resources can be
# be used by a normal user directly. More than one resource can be
# input using the character "%" as separator. e.g., resc1%resc2%resc3.
# This function is optional, but if used, should be the first function
# to execute because it screens the resource input.
# msiSetDefaultResc(defaultRescList, optionStr) - sets the default resource.
# From version 2.3 onward, this function is no longer mandatory, but
# if it is used, if should be executed right after the screening
# function msiSetNoDirectRescInp.
# defaultResc - the resource to use if no resource is input. A "null"
# means there is no defaultResc. More than one resources can be
# defaultRescList - the resource to use if no resource is input. A "null"
# means there is no defaultResc. More than one resource can be
# input using the character "%" as separator.
# optionStr - Can be "forced", "preferred" or "null". A "forced" input
# means the defaultResc will be used regardless of the user input.
# The forced action only apply to to users with normal privilege.
# means the defaultRescList will be used regardless of the user input.
# The forced action only applies to users with normal privilege.
# msiSetRescSortScheme(sortScheme) - set the scheme for
# for selecting the best resource to use when creating a data object.
# sortScheme - The sorting scheme. Valid scheme are "default",
# "random", "byLoad" and "byRescClass". The "byRescClass" scheme will put the
# cache class of resource on the top of the list. The "byLoad" scheme will put
# the least loaded resource on the top of the list: in order to work properly,
# the RMS system must be switched on in order to pick up the load information
# for each server in the resource group list.
# for each server in the resource list.
# The scheme "random" and "byRescClass" can be applied in sequence. e.g.,
# msiSetRescSortScheme(random); msiSetRescSortScheme(byRescClass)
# will select randomly a cache class resource and put it on the
Expand Down Expand Up @@ -179,22 +174,10 @@ acSetRescSchemeForRepl {msiSetDefaultResc("irodsResc","forced"); }
# msiSetDataObjAvoidResc(avoidResc) - set the resource to avoid when
# opening an object. The copy stored in this resource will not be picked
# unless this is the only copy.
# msiSortDataObj(sortingScheme) - Sort the copies of the data object using
# this scheme. Currently, "random" and "byRescClass" sorting scheme are
# supported. If "byRescClass" is set, data objects in the "cache"
# resources will be placed ahead of of those in the "archive" resources.
# The sorting schemes can also be chained. e.g.,
# msiSortDataObj(random); msiSortDataObj(byRescClass) means that
# the data objects will be sorted randomly first and then separated
# by class.
# msiStageDataObj(cacheResc) - stage a copy of the data object in the
# cacheResc before opening the data object.
# The $writeFlag session variable has been created to be used as a condition
# for differentiating between open for read ($writeFlag == "0") and
# write ($writeFlag == "1"). e.g. :
# acPreprocForDataObjOpen {ON($writeFlag == "0") {msiStageDataObj("demoResc8"); } }
# acPreprocForDataObjOpen {ON($writeFlag == "1") { } }
# acPreprocForDataObjOpen {msiSortDataObj("random"); msiSetDataObjPreferredResc("xyz%demoResc8%abc"); msiStageDataObj("demoResc8"); }
# acPreprocForDataObjOpen {msiSetDataObjPreferredResc("demoResc7%demoResc8"); }
acPreprocForDataObjOpen { }
# acPreprocForDataObjOpen {msiGetSessionVarValue("all","all"); }
Expand All @@ -221,35 +204,12 @@ acSetMultiReplPerResc { }
# in sequence by these rules.
# msiExtractNaraMetadata - extract and register metadata from the just
# upload NARA files.
# msiSysReplDataObj(replResc, flag) - can be used to replicate a copy of
# the file just uploaded or copied data object to the specified replResc
# Valid values for the "flag" input are "all", "updateRepl" and
# "rbudpTransfer". More than one flag values can be set using the
# "%" character as separator. e.g., "all%updateRepl". "updateRepl" means
# update an existing stale copy to the latest copy. The "all" flag means
# replicate to all resources in a resource group or update all stale
# copies if the "updateRepl" flag is also set. "rbudpTransfer" means
# the RBUDP protocol will be used for the transfer.
# A "null" input means a single will be made in one of the resource
# in the resource group.
# It may be desirable to do replication only if the dataObject is stored
# in a resource group. For example, the following rule can be used:
# acPostProcForPut {ON($rescGroupName != "") {msiSysReplDataObj($rescGroupName,"all"); } }
#
# msiSysChksumDataObj - checksum the just uploaded or copied data object.
# acPostProcForPut {msiSysChksumDataObj; msiSysReplDataObj("demoResc8","all"); }
# acPostProcForPut {msiSysReplDataObj("demoResc8","all"); }
# acPostProcForPut {msiSysChksumDataObj; }
# acPostProcForPut {delay("<A></A>") {msiSysReplDataObj('demoResc8','all'); } }
# acWriteLine(*A,*B) {writeLine(*A,*B); }
# acPostProcForPut {delay("<PLUSET>1m</PLUSET>") {acWriteLine('serverLog','delayed by a minute message1'); acWriteLine('serverLog','delayed by a minute message2'); } }
# acPostProcForPut {ON($objPath like "/tempZone/home/rods/nvo/*") {delay("<PLUSET>1m</PLUSET>") {msiSysReplDataObj('nvoReplResc','null'); } } }
# acPostProcForPut {msiSysReplDataObj("demoResc8","all"); }
#acPostProcForPut {msiSetDataTypeFromExt; }
#acPostProcForPut {ON($objPath like "/tempZone/home/rods/tg/*") {msiSysReplDataObj("nvoReplResc","null"); } }
#acPostProcForPut {ON($objPath like "/tempZone/home/rods/mytest/*") {writeLine("serverLog","File Path is "++$filePath); } }
#acPostProcForPut {ON($objPath like "/tempZone/home/rods/mytest/*") {writeLine("serverLog","File Path is "++$filePath); msiSplitPath($filePath,*fileDir,*fileName); msiExecCmd("send.sh", "*fileDir *fileName", "null", "null","null",*Junk); writeLine("serverLog","After File Path is *fileDir *fileName"); } }
#acPostProcForPut { ON($objPath like "\*txt") {writeLine("serverLog","File $objPath"); } }
# acPostProcForPut { ON($objPath like "\*txt") {writeLine("serverLog","File $objPath"); } }
acPostProcForPut { }
acPostProcForCopy { }
acPostProcForFilePathReg { }
Expand Down Expand Up @@ -378,15 +338,6 @@ acChkHostAccessControl { }
# acSetVaultPathPolicy {msiSetRandomScheme; }
acSetVaultPathPolicy {msiSetGraftPathScheme("no","1"); }
#
# 17) acSetReServerNumProc - This rule set the policy for the number of processes
# to use when running jobs in the irodsReServer. The irodsReServer can now
# multi-task such that one or two long running jobs cannot block the execution
# of other jobs. One function can be called:
# msiSetReServerNumProc(numProc) - numProc can be "default" or a number
# in the range 1-4. numProc will be set to 1 if "default" is the input.
#
acSetReServerNumProc {msiSetReServerNumProc("default"); }
#
# 18) acPreProcForCollCreate - This is the PreProcessing rule for creating
# a collection. Currently there is no function written specifically
# for this rule.
Expand Down Expand Up @@ -715,37 +666,6 @@ getSessionVar(*name, *output) {
*output = eval("str($"++*name++")");
}

# ----------------------------------------------------------------------------
# These rules are for testing only
#acDataObjCreate {acSetCreateConditions; acDOC; }
acSetCreateConditions {msiGetNewObjDescriptor ::: recover_msiGetNewObjDescriptor; acSetResourceList; }
acDOC {msiPhyDataObjCreate ::: recover_msiPhyDataObjCreate; acRegisterData ::: msiRollback; msiCommit; }
acSetResourceList {msiSetResourceList; }
acSetCopyNumber {msiSetCopyNumber; }
acRegisterData {msiRegisterData ::: msiRollback; }
#
#These are actions for getting iCAT results for performing iRODS operations.
#These rules generate the genQueryOut_ structure for each action for the given condition
#
acGetIcatResults(*Action,*Condition,*GenQOut) {ON((*Action == "replicate") %% (*Action == "trim") %% (*Action == "chksum") %% (*Action == "copy") %% (*Action == "remove")) {msiMakeQuery("DATA_NAME, COLL_NAME",*Condition,*Query); msiExecStrCondQuery(*Query, *GenQOut); cut; } }
acGetIcatResults(*Action,*Condition,*GenQOut) {ON(*Action == "chksumRescLoc") {msiMakeQuery("DATA_NAME, COLL_NAME, RESC_LOC",*Condition,*Query); msiExecStrCondQuery(*Query, *GenQOut); cut; } }
acGetIcatResults(*Action,*Condition,*GenQOut) {ON(*Action == "list") {msiMakeQuery("DATA_NAME, COLL_NAME, DATA_RESC_NAME, DATA_REPL_NUM, DATA_SIZE",*Condition,*Query); msiExecStrCondQuery(*Query, *GenQOut); cut; } }
#
#rules for purging a file which have expired
#
acPurgeFiles(*Condition) {ON((*Condition == "null") %% (*Condition == "")) {msiGetIcatTime(*Time,"unix"); acGetIcatResults("remove","DATA_EXPIRY < '*Time'",*List); foreach(*List) {msiDataObjUnlink(*List,*Status); msiGetValByKey(*List,"DATA_NAME",*D); msiGetValByKey(*List,"COLL_NAME",*E); writeLine("stdout","Purged File *E/*D at *Time"); } } }
acPurgeFiles(*Condition) {msiGetIcatTime(*Time,"unix"); acGetIcatResults("remove","DATA_EXPIRY < '*Time' AND *Condition",*List); foreach(*List) {msiDataObjUnlink(*List,*Status); msiGetValByKey(*List,"DATA_NAME",*D); msiGetValByKey(*List,"COLL_NAME",*E); writeLine("stdout","Purged File *E/*D at *Time"); } }
acConvertToInt(*R) {assign(*A,$sysUidClient); assign($sysUidClient,*R); assign(*K, $sysUidClient); assign(*R,*K); assign($sysUidClient,*A); }

#
# rule for running a workflow
#
acRunWorkFlow(*File, *R_BUF) {
msiDataObjOpen("objPath=*File++++openFlags=O_RDONLY",*S_FD);
msiDataObjRead(*S_FD,33554412,*R_BUF);
msiDataObjClose(*S_FD,*Status2);
}

acPostProcForParallelTransferReceived(*leaf_resource) {}

acPostProcForDataCopyReceived(*leaf_resource) {}
Expand All @@ -757,7 +677,7 @@ acPostProcForDataCopyReceived(*leaf_resource) {}

# =-=-=-=-=-=-=-
# policy controlling when a dataObject is staged to cache from archive in a compound coordinating resource
# - the default is to stage when cache is not present ("when_necessary")
# - the default is to stage when cache is stale or not present ("when_necessary")
# =-=-=-=-=-=-=-
# pep_resource_resolve_hierarchy_pre(*INSTANCE, *CONTEXT, *OUT, *OPERATION, *HOST, *PARSER, *VOTE){*OUT="compound_resource_cache_refresh_policy=when_necessary";} # default
# pep_resource_resolve_hierarchy_pre(*INSTANCE, *CONTEXT, *OUT, *OPERATION, *HOST, *PARSER, *VOTE){*OUT="compound_resource_cache_refresh_policy=always";}
Loading

0 comments on commit 08b4d02

Please sign in to comment.