#ignite-964: rename mapReduce method.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/1749345e Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/1749345e Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/1749345e Branch: refs/heads/ignite-964 Commit: 1749345ed60c35388e1917c47848897655a62ead Parents: 29300a4 Author: ivasilinets <ivasilin...@gridgain.com> Authored: Thu Jul 9 18:30:09 2015 +0300 Committer: ivasilinets <ivasilin...@gridgain.com> Committed: Thu Jul 9 18:30:09 2015 +0300 ---------------------------------------------------------------------- examples/src/main/js/cache-query-example.js | 2 +- examples/src/main/js/map-reduce-example.js | 2 +- examples/src/main/js/run-cache-script.js | 6 +++--- examples/src/main/js/run-function-example.js | 8 ++++---- modules/nodejs/src/main/js/compute.js | 8 ++++---- modules/nodejs/src/test/js/test-compute.js | 24 +++++++++++------------ 6 files changed, 25 insertions(+), 25 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1749345e/examples/src/main/js/cache-query-example.js ---------------------------------------------------------------------- diff --git a/examples/src/main/js/cache-query-example.js b/examples/src/main/js/cache-query-example.js index 1b774a0..04ffb1e 100644 --- a/examples/src/main/js/cache-query-example.js +++ b/examples/src/main/js/cache-query-example.js @@ -29,7 +29,7 @@ Ignition.start(['127.0.0.1:9095'], null, onConnect); function onConnect(err, ignite) { console.log(">>> Cache query example started."); - var entries = [new Entry("key0", "val0"), new Entry("key1", "val1")]; + var entries = [new CacheEntry("key0", "val0"), new CacheEntry("key1", "val1")]; ignite.getOrCreateCache(cacheName, function(err, cache) { cache.putAll(entries, onCachePut.bind(null, ignite)); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1749345e/examples/src/main/js/map-reduce-example.js ---------------------------------------------------------------------- diff --git a/examples/src/main/js/map-reduce-example.js b/examples/src/main/js/map-reduce-example.js index e56b99d..ab02bf8 100644 --- a/examples/src/main/js/map-reduce-example.js +++ b/examples/src/main/js/map-reduce-example.js @@ -75,7 +75,7 @@ function main() { console.log(">>> End of compute map reduce example."); } - ignite.compute().execute(map, reduce, "Hello Ignite Enabled World!", onMapReduce); + ignite.compute().mapReduce(map, reduce, "Hello Ignite Enabled World!", onMapReduce); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1749345e/examples/src/main/js/run-cache-script.js ---------------------------------------------------------------------- diff --git a/examples/src/main/js/run-cache-script.js b/examples/src/main/js/run-cache-script.js index d4d72cc..b27721d 100644 --- a/examples/src/main/js/run-cache-script.js +++ b/examples/src/main/js/run-cache-script.js @@ -63,15 +63,15 @@ function main() { return val.salary; } - /** Run remote job on server ignite node with arguments [cacheName, key]. */ - ignite.compute().runScript(job, [cacheName, key], onRun); - var onRun = function(err, salary) { console.log(">>> " + key + "'s salary is " + salary); // Destroying cache. ignite.destroyCache(cacheName, function(err) { console.log(">>> End of run cache script example."); }); } + + /** Run remote job on server ignite node with arguments [cacheName, key]. */ + ignite.compute().run(job, [cacheName, key], onRun); } } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1749345e/examples/src/main/js/run-function-example.js ---------------------------------------------------------------------- diff --git a/examples/src/main/js/run-function-example.js b/examples/src/main/js/run-function-example.js index 832f9d6..740dc20 100644 --- a/examples/src/main/js/run-function-example.js +++ b/examples/src/main/js/run-function-example.js @@ -51,13 +51,13 @@ function main() { return sum; } - // Execute job on ignite server node. - ignite.compute().runScript(job, "Hello Ignite Enabled World!", onRun); - - function onRun(err, sum) { + var onRun = function(err, sum) { console.log(">>> Total number of characters in the phrase is '" + sum + "'."); console.log(">>> End of compute callable example."); } + + // Execute job on ignite server node. + ignite.compute().run(job, "Hello Ignite Enabled World!", onRun); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1749345e/modules/nodejs/src/main/js/compute.js ---------------------------------------------------------------------- diff --git a/modules/nodejs/src/main/js/compute.js b/modules/nodejs/src/main/js/compute.js index 7f56e1c..16de9e4 100644 --- a/modules/nodejs/src/main/js/compute.js +++ b/modules/nodejs/src/main/js/compute.js @@ -29,12 +29,12 @@ function Compute(server) { /** * @this {Compute} - * @param runnable Function without parameters + * @param job Function * @param args Function arguments * @param {onGet} callback Callback */ -Compute.prototype.runScript = function(runnable, args, callback) { - this._server.runCommand(new Command("runscript").addParam("func", runnable). +Compute.prototype.run = function(job, args, callback) { + this._server.runCommand(new Command("runscript").addParam("func", job). setPostData(JSON.stringify({"arg" : args})), callback); } @@ -45,7 +45,7 @@ Compute.prototype.runScript = function(runnable, args, callback) { * @param {string} arg Argument * @param {onGet} callback Callback */ -Compute.prototype.execute = function(map, reduce, arg, callback) { +Compute.prototype.mapReduce = function(map, reduce, arg, callback) { var command = new Command("excmapreduce"); command.addParam("map", map).addParam("reduce", reduce); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1749345e/modules/nodejs/src/test/js/test-compute.js ---------------------------------------------------------------------- diff --git a/modules/nodejs/src/test/js/test-compute.js b/modules/nodejs/src/test/js/test-compute.js index 111d79f..5d865ce 100644 --- a/modules/nodejs/src/test/js/test-compute.js +++ b/modules/nodejs/src/test/js/test-compute.js @@ -71,7 +71,7 @@ testComputeRunScriptContainsKey = function() { var initKey = {"1" : ["1", "2"]}; - comp.runScript(f, initKey, onEnd.bind(null)); + comp.run(f, initKey, onEnd.bind(null)); } TestUtils.startIgniteNode(computeRunScriptContainsKey); @@ -108,7 +108,7 @@ testComputeRunScriptContainsKeys = function() { var initKey0 = {"1" : ["1", "2"]}; var initKey1 = {"2" : "AAA"}; - comp.runScript(f, [initKey0, initKey1], onEnd.bind(null)); + comp.run(f, [initKey0, initKey1], onEnd.bind(null)); } TestUtils.startIgniteNode(computeRunScriptContainsKey); @@ -147,7 +147,7 @@ testComputeRunScriptPutAllGetAll = function() { var initVal1 = {"2" : "AAA"}; var initEntries = [new CacheEntry(initKey0, initVal0), new CacheEntry(initKey1, initVal1)]; - comp.runScript(f, [initEntries, [initKey0, initKey1]], + comp.run(f, [initEntries, [initKey0, initKey1]], onEnd.bind(null)); } @@ -236,7 +236,7 @@ testComputeRunScriptRemoveOperations = function() { TestUtils.testDone(); } - comp.runScript(f, [], onEnd.bind(null)); + comp.run(f, [], onEnd.bind(null)); } TestUtils.startIgniteNode(computeRunScriptRemoveOperations); @@ -289,7 +289,7 @@ testComputeMapReduceGetAndPut = function() { TestUtils.testDone(); } - ignite.compute().execute(map, reduce, [], callback); + ignite.compute().mapReduce(map, reduce, [], callback); } TestUtils.startIgniteNode(computeMapReduceGetAndPut); @@ -350,7 +350,7 @@ testComputeMapReduceGetAndRemoveObject = function() { entries.push(new CacheEntry(key1, val1)); entries.push(new CacheEntry(key2, val2)); - ignite.compute().execute(map, reduce, entries, callback); + ignite.compute().mapReduce(map, reduce, entries, callback); } TestUtils.startIgniteNode(computeMapReduceGetAndRemove); @@ -386,7 +386,7 @@ function computeRunScript(ignite, error) { TestUtils.testDone(); } - comp.runScript(f, "GridGain", onEnd.bind(null)); + comp.run(f, "GridGain", onEnd.bind(null)); } function computeExecute(error, ignite) { @@ -423,7 +423,7 @@ function computeExecute(error, ignite) { TestUtils.testDone(); } - ignite.compute().execute(map, reduce, "Hi Alice", callback); + ignite.compute().mapReduce(map, reduce, "Hi Alice", callback); } function computeAllNodeExecute(error, ignite) { @@ -448,7 +448,7 @@ function computeAllNodeExecute(error, ignite) { TestUtils.testDone(); } - ignite.compute().execute(map, reduce, "", callback); + ignite.compute().mapReduce(map, reduce, "", callback); } function computeCacheExecute(error, ignite) { @@ -521,7 +521,7 @@ function computeCacheExecute(error, ignite) { entries.push(new CacheEntry(key2, val2)); ignite.cache("mycache").putAll(entries, function(err) { - ignite.compute().execute(map, reduce, [key1, val1], callback); + ignite.compute().mapReduce(map, reduce, [key1, val1], callback); }); } @@ -561,7 +561,7 @@ function computeCacheSizeExecute(error, ignite) { ignite.cache("mycache").put("key", "val", function(err) { - ignite.compute().execute(map, reduce, "", callback); + ignite.compute().mapReduce(map, reduce, "", callback); }); } @@ -616,7 +616,7 @@ function testComputeWithErrors(map) { TestUtils.testDone(); } - ignite.compute().execute(map, function (args) {}, "Hi Alice", callback); + ignite.compute().mapReduce(map, function (args) {}, "Hi Alice", callback); } TestUtils.startIgniteNode(computeErrorExecute);