You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by iv...@apache.org on 2015/07/13 08:35:45 UTC

[44/50] [abbrv] incubator-ignite git commit: #ignite-964: fix review comments.

#ignite-964: fix review comments.


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

Branch: refs/heads/ignite-961
Commit: 86e5d093b67907eb7fe4e5ea1ce86a006ca6089c
Parents: 7d4f378
Author: ivasilinets <iv...@gridgain.com>
Authored: Fri Jul 10 18:48:57 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Fri Jul 10 18:48:57 2015 +0300

----------------------------------------------------------------------
 examples/src/main/js/cache-api-example.js       | 13 ++--
 examples/src/main/js/cache-put-get-example.js   |  5 +-
 examples/src/main/js/cache-query-example.js     | 15 ++---
 .../main/js/cache-sql-fields-query-example.js   | 15 ++---
 examples/src/main/js/compute-run-example.js     |  5 +-
 examples/src/main/js/map-reduce-example.js      | 14 ++--
 examples/src/main/js/run-function-example.js    | 67 --------------------
 7 files changed, 31 insertions(+), 103 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/86e5d093/examples/src/main/js/cache-api-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/cache-api-example.js b/examples/src/main/js/cache-api-example.js
index 85f9fde..07d14f3 100644
--- a/examples/src/main/js/cache-api-example.js
+++ b/examples/src/main/js/cache-api-example.js
@@ -21,10 +21,9 @@ var Ignition = apacheIgnite.Ignition;
 /**
   * This example demonstrates some of the cache rich API capabilities.
   * <p>
-  * Remote nodes should always be started with special configuration file which
-  * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/js/example-js-cache.xml'}.
+  * Start Ignite node with {@code examples/config/js/example-js-cache.xml} configuration before running example.
   * <p>
-  * Alternatively you can run ExampleJsNodeStartup in another JVM which will
+  * Alternatively you can run ExampleJsNodeStartup which will
   * start node with {@code examples/config/js/example-js-cache.xml} configuration.
   */
 function main() {
@@ -42,8 +41,8 @@ function main() {
 
         // Create cache on server with cacheName.
         ignite.getOrCreateCache(cacheName, function(err, cache) {
-                atomicMapOperations(ignite, cache);
-            });
+            atomicMapOperations(ignite, cache);
+        });
     }
 
     /**
@@ -92,8 +91,8 @@ function main() {
 
             // Destroying cache.
             ignite.destroyCache(cacheName, function(err) {
-                    console.log(">>> End of Cache API example.");
-                });
+                console.log(">>> End of Cache API example.");
+            });
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/86e5d093/examples/src/main/js/cache-put-get-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/cache-put-get-example.js b/examples/src/main/js/cache-put-get-example.js
index 42a9cf8..8155cb7 100644
--- a/examples/src/main/js/cache-put-get-example.js
+++ b/examples/src/main/js/cache-put-get-example.js
@@ -22,10 +22,9 @@ var CacheEntry = apacheIgnite.CacheEntry;
 /**
   * This example demonstrates very basic operations on cache, such as 'put' and 'get'.
   * <p>
-  * Remote nodes should always be started with special configuration file which
-  * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/js/example-js-cache.xml'}.
+  * Start Ignite node with {@code examples/config/js/example-js-cache.xml} configuration before running example.
   * <p>
-  * Alternatively you can run ExampleJsNodeStartup in another JVM which will
+  * Alternatively you can run ExampleJsNodeStartup which will
   * start node with {@code examples/config/js/example-js-cache.xml} configuration.
   */
 function main() {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/86e5d093/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 18b1482..3566ac8 100644
--- a/examples/src/main/js/cache-query-example.js
+++ b/examples/src/main/js/cache-query-example.js
@@ -26,10 +26,9 @@ var CacheEntry = apacheIgnite.CacheEntry;
 /**
   * Cache queries example. This example demonstrates SQL queries over cache.
   * <p>
-  * Remote nodes should always be started with special configuration file which
-  * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/js/example-js-cache.xml'}.
+  * Start Ignite node with {@code examples/config/js/example-js-cache.xml} configuration before running example.
   * <p>
-  * Alternatively you can run ExampleJsNodeStartup in another JVM which will
+  * Alternatively you can run ExampleJsNodeStartup which will
   * start node with {@code examples/config/js/example-js-cache.xml} configuration.
   */
 main() {
@@ -48,12 +47,12 @@ main() {
         var entries = initializeEntries();
 
         ignite.getOrCreateCache(cacheName, function(err, cache) {
-                cacheQuery(ignite, cache, entries);
-            });
+            cacheQuery(ignite, cache, entries);
+        });
     }
 
     function cacheQuery(ignite, cache, entries) {
-        cache.putAll(entries, onCachePut.bind(null, ignite));
+        cache.putAll(entries, onCachePut);
 
         function onCachePut(ignite, err) {
             console.log(">>> Create cache for people.")
@@ -84,8 +83,8 @@ main() {
 
                 // Destroying cache.
                 ignite.destroyCache(cacheName, function(err) {
-                        console.log(">>> End of query example.");
-                    });
+                    console.log(">>> End of query example.");
+                });
             });
 
             //Run query.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/86e5d093/examples/src/main/js/cache-sql-fields-query-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/cache-sql-fields-query-example.js b/examples/src/main/js/cache-sql-fields-query-example.js
index 64a50f7..c16fbe6 100644
--- a/examples/src/main/js/cache-sql-fields-query-example.js
+++ b/examples/src/main/js/cache-sql-fields-query-example.js
@@ -25,10 +25,9 @@ var CacheEntry = apacheIgnite.CacheEntry;
 /**
   * Cache queries example. This example demonstrates SQL queries over cache.
   * <p>
-  * Remote nodes should always be started with special configuration file which
-  * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/js/example-js-cache.xml'}.
+  * Start Ignite node with {@code examples/config/js/example-js-cache.xml} configuration before running example.
   * <p>
-  * Alternatively you can run ExampleJsNodeStartup in another JVM which will
+  * Alternatively you can run ExampleJsNodeStartup which will
   * start node with {@code examples/config/js/example-js-cache.xml} configuration.
   */
 main() {
@@ -47,8 +46,8 @@ main() {
         var entries = initializeEntries();
 
         ignite.getOrCreateCache(cacheName, function(err, cache) {
-                cacheSqlFieldsQuery(ignite, cache, entries);
-            });
+            cacheSqlFieldsQuery(ignite, cache, entries);
+        });
     }
 
     function cacheSqlFieldsQuery(ignite, cache, entries) {
@@ -74,12 +73,12 @@ main() {
 
             //This function is called when query is finished.
             qry.on("end", function(err) {
-                console.log(">>> Names of all employees:): " + JSON.stringify(fullRes));
+                console.log(">>> Names of all employees: " + JSON.stringify(fullRes));
                     
                 // Destroying cache.
                 ignite.destroyCache(cacheName, function(err) {
-                        console.log(">>> End of sql fields query example.");
-                    });
+                    console.log(">>> End of sql fields query example.");
+                });
             });
 
             //Run query.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/86e5d093/examples/src/main/js/compute-run-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/compute-run-example.js b/examples/src/main/js/compute-run-example.js
index 18d5452..a14dcda 100644
--- a/examples/src/main/js/compute-run-example.js
+++ b/examples/src/main/js/compute-run-example.js
@@ -21,10 +21,9 @@ var Ignition = apacheIgnite.Ignition;
 /**
   * This example demonstrates very basic operations on cache in functions for Compute.run.
   * <p>
-  * Remote nodes should always be started with special configuration file which
-  * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/js/example-js-cache.xml'}.
+  * Start Ignite node with {@code examples/config/js/example-js-cache.xml} configuration before running example.
   * <p>
-  * Alternatively you can run ExampleJsNodeStartup in another JVM which will
+  * Alternatively you can run ExampleJsNodeStartup which will
   * start node with {@code examples/config/js/example-js-cache.xml} configuration.
   */
 function main() {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/86e5d093/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 8adf095..98b863b 100644
--- a/examples/src/main/js/map-reduce-example.js
+++ b/examples/src/main/js/map-reduce-example.js
@@ -24,13 +24,12 @@ var Ignition = apacheIgnite.Ignition;
  * Phrase passed as task argument is split into jobs each taking one word. Then jobs are distributed among
  * cluster nodes. Each node computes word length and returns result to master node where total phrase length
  * is calculated on reduce stage.
- * <p>
- * Remote nodes should always be started with special configuration file which
- * enables P2P class loading: {@code examples/config/js/example-js-cache.xml}.
- * <p>
- * Alternatively you can run ExampleJsNodeStartup in another JVM which will start node
- * with {@code examples/config/js/example-js-cache.xml} configuration.
- */
+  * <p>
+  * Start Ignite node with {@code examples/config/js/example-js-cache.xml} configuration before running example.
+  * <p>
+  * Alternatively you can run ExampleJsNodeStartup which will
+  * start node with {@code examples/config/js/example-js-cache.xml} configuration.
+  */
 function main() {
     /** Connect to node that started with {@code examples/config/js/example-js-cache.xml} configuration. */
     Ignition.start(['127.0.0.1:9095'], null, onConnect);
@@ -55,6 +54,7 @@ function main() {
                     return word.length;
                 };
 
+                //Add job to node with arguments.
                 emit(job, words[i], nodes[i %  nodes.length]);
             }
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/86e5d093/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
deleted file mode 100644
index bec1e9f..0000000
--- a/examples/src/main/js/run-function-example.js
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var apacheIgnite = require("apache-ignite");
-var Ignition = apacheIgnite.Ignition;
-
-/**
-  * Demonstrates using of Compute job execution on the cluster.
-  * <p>
-  * This example takes a sentence composed of multiple words and counts number of non-space
-  * characters in the sentence by having each compute job count characters in each individual
-  * word.
-* <p>
-  * <p>
-  * Remote nodes should always be started with special configuration file which
-  * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/js/example-js-cache.xml'}.
-  * <p>
-  * Alternatively you can run ExampleJsNodeStartup in another JVM which will
-  * start node with {@code examples/config/js/example-js-cache.xml} configuration.
-  */
-function main() {
-    /** Connect to node that started with {@code examples/config/js/example-js-cache.xml} configuration. */
-    Ignition.start(['127.0.0.1:9095'], null, onConnect);
-
-    function onConnect(err, ignite) {
-        if (err !== null)
-            throw "Start remote node with config examples/config/js/example-js-cache.xml.";
-
-        console.log(">>> Compute callable example started");
-
-        var job = function (args) {
-            var words = args.split(" ");
-
-            var sum = 0;
-
-            for (var i = 0; i < words.length; ++i) {
-                sum += words[i].length;
-            }
-
-            return 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);
-    }
-}
-
-main();
\ No newline at end of file