You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sf...@apache.org on 2014/11/22 00:42:45 UTC

incubator-usergrid git commit: adding comments

Repository: incubator-usergrid
Updated Branches:
  refs/heads/index-alias b16c728f0 -> 5d613dca3


adding comments


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

Branch: refs/heads/index-alias
Commit: 5d613dca337e23314851b4c0e1aba3e5fa3788e9
Parents: b16c728
Author: Shawn Feldman <sf...@apache.org>
Authored: Fri Nov 21 16:42:36 2014 -0700
Committer: Shawn Feldman <sf...@apache.org>
Committed: Fri Nov 21 16:42:36 2014 -0700

----------------------------------------------------------------------
 .../persistence/index/IndexIdentifier.java      | 21 ++++++++++++++++----
 .../index/impl/EsEntityIndexImpl.java           |  5 +++++
 2 files changed, 22 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5d613dca/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexIdentifier.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexIdentifier.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexIdentifier.java
index 13af8eb..c65a740 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexIdentifier.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexIdentifier.java
@@ -35,19 +35,32 @@ public class IndexIdentifier{
         this.applicationScope = applicationScope;
     }
 
+    /**
+     * Get the alias name
+     * @return
+     */
     public String getAlias() {
         return getIndexBase() + config.getAliasPostfix();
     }
 
-    public String getIndex(int i) {
-        if (i > 0) {
-            return getIndexBase() + "_v" + (i + 1);
+    /**
+     * Get index name, send in additional parameter to add incremental indexes
+     * @param version
+     * @return
+     */
+    public String getIndex(int version) {
+        if (version > 0) {
+            return getIndexBase() + "_v" + (version + 1);
         } else {
             return getIndexBase();
         }
     }
 
-    String getIndexBase() {
+    /**
+     * returns the base name for index which will be used to add an alias and index
+     * @return
+     */
+    private String getIndexBase() {
         StringBuilder sb = new StringBuilder();
         sb.append(config.getIndexPrefix()).append(IndexingUtils.SEPARATOR);
         IndexingUtils.idString(sb, applicationScope.getApplication());

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5d613dca/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
index baa3551..fa5197e 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
@@ -174,6 +174,11 @@ public class EsEntityIndexImpl implements EntityIndex {
         }
     }
 
+    /**
+     * Create the index and alias
+     * @param admin
+     * @param settings
+     */
     private void createIndexAndAlias(AdminClient admin, Settings settings) {
         String indexVersionName =  indexIdentifier.getIndex(0);
         final CreateIndexResponse cir = admin.indices().prepareCreate( indexVersionName ).setSettings( settings ).execute().actionGet();