-
Notifications
You must be signed in to change notification settings - Fork 12
/
uuBatch.r
50 lines (44 loc) · 1.54 KB
/
uuBatch.r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# \file uuBatch.r
# \brief Batch functionality.
# \author Felix Croes
# \copyright Copyright (c) 2022, Utrecht University. All rights reserved.
# \license GPLv3, see LICENSE.
verifyChecksumBatch(*start, *max, *update) {
*bucket = 0;
foreach (*row in SELECT ORDER(DATA_ID),COLL_NAME,DATA_NAME,DATA_SIZE,DATA_CHECKSUM WHERE COLL_NAME LIKE '/$rodsZoneClient/home/vault%' AND DATA_ID >= '*start') {
*coll = *row.COLL_NAME;
*data = *row.DATA_NAME;
verifyChecksumData("*coll/*data", *row.DATA_CHECKSUM, *update);
*bucket = *bucket + int(*row.DATA_SIZE);
if (*bucket >= *max) {
*start = int(*row.DATA_ID) + 1;
delay ("<INST_NAME>irods_rule_engine_plugin-irods_rule_language-instance</INST_NAME><PLUSET>1s</PLUSET>") {
verifyChecksumBatch(*start, *max, *update);
}
break;
}
}
}
verifyChecksumData(*path, *chksum, *update) {
msiCheckAccess(*path, "read object", *access);
if (*access == 0) {
msiSetACL("default", "admin:read", uuClientFullName, *path);
}
if (*chksum == "") {
writeLine("serverLog", "*path: no checksum");
if (*update != 0) {
errorcode(msiDataObjChksum(*path, "ChksumAll=", *status));
}
} else {
msiSubstr(*chksum, "0", "5", *type);
writeLine("serverLog", "*path: *chksum");
if (*type == "sha2:") {
errorcode(msiDataObjChksum(*path, "verifyChksum=", *status));
} else if (*update != 0) {
errorcode(msiDataObjChksum(*path, "ChksumAll=++++forceChksum=", *status));
}
}
if (*access == 0) {
msiSetACL("default", "admin:null", uuClientFullName, *path);
}
}