Commit a35b07ec authored by Tristan Cavelier's avatar Tristan Cavelier

job rule condition added + default job rules modified

parent 298da338
...@@ -387,6 +387,23 @@ defaults.job_rule_conditions = {}; ...@@ -387,6 +387,23 @@ defaults.job_rule_conditions = {};
methodType(b.method) === 'writer'; methodType(b.method) === 'writer';
} }
/**
* Compare two jobs and test if they use metadata only
*
* @param {Object} a The first job to compare
* @param {Object} b The second job to compare
* @return {Boolean} True if equal, else false
*/
function useMetadataOnly(a, b) {
if (['post', 'put', 'get', 'remove', 'allDocs'].indexOf(a.method) === -1) {
return false;
}
if (['post', 'put', 'get', 'remove', 'allDocs'].indexOf(b.method) === -1) {
return false;
}
return true;
}
/** /**
* Compare two jobs and test if they are readers * Compare two jobs and test if they are readers
* *
...@@ -466,6 +483,7 @@ defaults.job_rule_conditions = {}; ...@@ -466,6 +483,7 @@ defaults.job_rule_conditions = {};
"sameStorageDescription": sameStorageDescription, "sameStorageDescription": sameStorageDescription,
"areWriters": areWriters, "areWriters": areWriters,
"areReaders": areReaders, "areReaders": areReaders,
"useMetadataOnly": useMetadataOnly,
"sameMethod": sameMethod, "sameMethod": sameMethod,
"sameDocumentId": sameDocumentId, "sameDocumentId": sameDocumentId,
"sameParameters": sameParameters, "sameParameters": sameParameters,
......
...@@ -213,10 +213,11 @@ function enableJobChecker(jio, shared, options) { ...@@ -213,10 +213,11 @@ function enableJobChecker(jio, shared, options) {
], ],
"action": "update" "action": "update"
}, { }, {
"code_name": "writers update", "code_name": "metadata writers update",
"conditions": [ "conditions": [
"sameStorageDescription", "sameStorageDescription",
"areWriters", "areWriters",
"useMetadataOnly",
"sameMethod", "sameMethod",
"haveDocumentIds", "haveDocumentIds",
"sameParameters" "sameParameters"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment