Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
irods-rules
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RDM Infrastructure
irods-rules
Commits
788fe3d6
Commit
788fe3d6
authored
4 years ago
by
Staiger, Christine
Browse files
Options
Downloads
Patches
Plain Diff
Adding metadata-driven data replication.
parent
c9016eb0
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ruleEngines/metadatahooks.re
+106
-0
106 additions, 0 deletions
ruleEngines/metadatahooks.re
with
106 additions
and
0 deletions
ruleEngines/metadatahooks.re
0 → 100644
+
106
−
0
View file @
788fe3d6
######################################################
#
Metadata
policies
#
#
The
tag
"RESOURCE"
is
reserved
for
data
objects
only
.
#
It
can
only
take
the
values
:
#
disk
,
archive
,
dual
#
#
The
rules
below
replicate
the
data
according
to
the
#
resource
tag
:
#
disk
:
demoResc
#
archive
:
500
Gvault
#
dual
:
disk
and
archive
#
During
the
replication
the
data
is
always
updated
#
to
the
latest
copy
.
#
#
Author
:
Christine
Staiger
(
2021
)
#######################################################
#
Policy
when
metadata
is
newly
created
on
data
objects
#
add
,
adda
,
addw
,
set
acPreProcForModifyAVUMetadata
(
*
Option
,*
ItemType
,*
ItemName
,*
AName
,*
AValue
,*
AUnit
){
on
(
*
AName
==
"RESOURCE"
&&
(
*
AValue
==
'
archive'
||
*
AValue
==
'
disk'
||
*
AValue
==
'
dual'
)
&&
*
ItemType
==
"-d"
&&
*
Option
!=
"rm"
&&
*
Option
!=
"rmw"
&&
*
Option
!=
"rmi"
){
writeLine
(
"serverLog"
,
"PREPROCESSING: CREATE METADATA"
);
writeLine
(
"serverLog"
,
"DEBUG *Option,*ItemType,*ItemName,*AName,*AValue,*AUnit"
);
rescPolicy
(
*
ItemName
,
*
AValue
);
}
}
acPreProcForModifyAVUMetadata
(
*
Option
,*
ItemType
,*
ItemName
,*
AName
,*
AValue
,*
AUnit
){
on
(
*
AName
!=
"RESOURCE"
||
*
Option
==
"rm"
||
*
Option
==
"rmw"
||
*
Option
==
"rmi"
){}
}
#
Policy
when
metadata
is
modified
on
data
objects
acPreProcForModifyAVUMetadata
(
*
Option
,*
ItemType
,*
ItemName
,*
AName
,*
AValue
,*
AUnit
,
*
NAName
,
*
NAValue
,
*
NAUnit
){
on
(
*
AName
==
"RESOURCE"
&&
(
*
AValue
==
'
archive'
||
*
AValue
==
'
disk'
||
*
AValue
==
'
dual'
)
&&
*
ItemType
==
"-d"
){
writeLine
(
"serverLog"
,
"PREPROCESSING: MODIFY METADATA"
);
writeLine
(
"serverLog"
,
"DEBUG *Option,*ItemType,*ItemName,*AName,*AValue,*AUnit,*NAName,*NAValue,*NAUnit"
);
*
newval
=
substr
(
*
NAValue
,
2
,
strlen
(
*
NAValue
));
writeLine
(
"serverLog"
,
*
newval
);
rescPolicy
(
*
ItemName
,
*
newval
);
}
}
acPreProcForModifyAVUMetadata
(
*
Option
,*
ItemType
,*
ItemName
,*
AName
,*
AValue
,*
AUnit
,
*
NAName
,
*
NAValue
,
*
NAUnit
){
on
(
*
AName
!=
"RESOURCE"
){}
}
#
Policy
for
copying
metadata
-->
doing
nothing
for
the
moment
#
acPreProcForModifyAVUMetadata
(
#*
Option
,*
SourceItemType
,*
TargetItemType
,*
SourceItemName
,*
TargetItemName
){
#
writeLine
(
"serverLog"
,
"PREPROCESSING: COPY METADATA"
);
#
writeLine
(
"serverLog"
,
#
"DEBUG *Option,*SourceItemType,*TargetItemType,*SourceItemName,*TargetItemName"
)
#
}
#
General
reosurce
policy
for
data
objects
rescPolicy
(
*
abspath
,
*
value
){
on
(
*
value
==
"archive"
){
*
archive
=
"500Gvault"
;
replicate
(
*
abspath
,
*
archive
);
foreach
(
*
row
in
select
RESC_NAME
where
RESC_NAME
!=
*
archive
){
*
resc
=
*
row
.
RESC_NAME
;
writeLine
(
"serverLog"
,
"DEBUG msiDataObjTrim(*abspath, *resc, null, 1, null, state)"
);
errormsg
(
msiDataObjTrim
(
*
abspath
,
*
resc
,
"null"
,
"1"
,
"null"
,
*
state
)
,
*
err
);
writeLine
(
"serverLog"
,
"DEBUG TRIM: state *state, trimming error message --> *err"
);
}
}
}
rescPolicy
(
*
abspath
,
*
value
){
on
(
*
value
==
"disk"
||
*
value
==
""
){
*
disk
=
"demoResc"
;
replicate
(
*
abspath
,
*
disk
);
foreach
(
*
row
in
select
RESC_NAME
where
RESC_NAME
!=
*
disk
){
*
resc
=
*
row
.
RESC_NAME
;
writeLine
(
"serverLog"
,
"DEBUG msiDataObjTrim(*abspath, *resc, null, 1, null, state)"
);
errormsg
(
msiDataObjTrim
(
*
abspath
,
*
resc
,
"null"
,
"1"
,
"null"
,
*
state
)
,
*
err
);
writeLine
(
"serverLog"
,
"DEBUG TRIM: state *state, trimming error message --> *err"
);
}
}
}
rescPolicy
(
*
abspath
,
*
value
){
on
(
*
value
==
"dual"
){
*
archive
=
"500Gvault"
;
*
disk
=
"demoResc"
;
replicate
(
*
abspath
,
*
archive
);
replicate
(
*
abspath
,
*
disk
);
}
}
replicate
(
*
abspath
,
*
rescname
){
writeLine
(
"serverLog"
,
"DEBUG REPLICATE: *abspath"
);
errormsg
(
msiDataObjRepl
(
*
abspath
,
"destRescName=*rescname++++verifyChksum="
,
*
state
)
,
*
err
);
writeLine
(
"serverLog"
,
"DEBUG REPLICATE: state *state, repl error message --> *err"
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment