You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/06/23 19:47:40 UTC

[14/20] incubator-ignite git commit: #ignite-965: code style compute.js

#ignite-965: code style compute.js


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/da3e887b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/da3e887b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/da3e887b

Branch: refs/heads/ignite-965
Commit: da3e887b6f20ac7374f3c32438289942c7385565
Parents: 905a3e6
Author: ivasilinets <iv...@gridgain.com>
Authored: Tue Jun 23 20:20:50 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Tue Jun 23 20:20:50 2015 +0300

----------------------------------------------------------------------
 modules/nodejs/src/main/js/compute.js | 46 ++++++++++++++----------------
 1 file changed, 21 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/da3e887b/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 00f7b54..bce737a 100644
--- a/modules/nodejs/src/main/js/compute.js
+++ b/modules/nodejs/src/main/js/compute.js
@@ -20,23 +20,18 @@ var Server = require("./server").Server;
 /**
  * @constructor
  * @this {Compute}
- * @param {Server} server Server class
+ * @param {Server} server Server
  */
 function Compute(server) {
   this._server = server;
 }
 
 /**
- * Callback for affinityRun
- * @callback Compute~runnable
- */
-
-/**
  * @this {Compute}
- * @param {string} cacheName Cache name.
- * @param {string} key Key.
- * @param {Compute~runnable} runnable Function without parameters
- * @param {Cache~noValue} callback Callback
+ * @param {string} cacheName Cache name
+ * @param {string} key Key
+ * @param runnable Function without parameters and return value
+ * @param {noValue} callback Callback
  */
 Compute.prototype.affinityRun = function(cacheName, key, runnable, callback) {
   this._server.runCommand("affscriptrun", [Server.pair("cacheName", cacheName),
@@ -45,10 +40,10 @@ Compute.prototype.affinityRun = function(cacheName, key, runnable, callback) {
 
 /**
  * @this {Compute}
- * @param {string} cacheName Cache name.
- * @param {string} key Key.
- * @param {Compute~runnable} runnable Function without parameters
- * @param {Cache~onGet} callback Callback
+ * @param {string} cacheName Cache name
+ * @param {string} key Key
+ * @param runnable Function without parameters
+ * @param {onGet} callback Callback
  */
 Compute.prototype.affinityCall = function(cacheName, key, runnable, callback) {
   this._server.runCommand("affscriptcall", [Server.pair("cacheName", cacheName),
@@ -56,29 +51,30 @@ Compute.prototype.affinityCall = function(cacheName, key, runnable, callback) {
 }
 
 /**
- * @param{Cache~noValue} f Function
+ * @param {noValue} f Function
  * @returns {string} Encoding function
  */
 Compute.prototype._escape = function(f) {
-  var f = f.toString();
   var qs = require('querystring');
-  return qs.escape(f);
+
+  return qs.escape(f.toString());
 }
 
 /**
  * @this {Compute}
- * @param {ComputeTask} task Compute task
- * @param {string} arg  Argument
- * @param {} callback Callback
+ * @param {MapFunction} map Map function
+ * @param {ReduceFunction} reduce Reduce function
+ * @param {string} arg Argument
+ * @param {onGet} callback Callback
  */
 Compute.prototype.execute = function(map, reduce, arg, callback) {
-   var params = [];
+  var params = [];
 
-    params.push(Server.pair("map", this._escape(map)));
-    params.push(Server.pair("reduce", this._escape(reduce)));
-    params.push(Server.pair("arg", this._escape(arg)));
+  params.push(Server.pair("map", this._escape(map)));
+  params.push(Server.pair("reduce", this._escape(reduce)));
+  params.push(Server.pair("arg", this._escape(arg)));
 
-    this._server.runCommand("execscripttask", params, callback);
+  this._server.runCommand("execscripttask", params, callback);
 }
 
 /**