usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From toddn...@apache.org
Subject [1/4] incubator-usergrid git commit: WIP overwrite
Date Fri, 10 Apr 2015 00:25:48 GMT
Repository: incubator-usergrid
Updated Branches:
  refs/heads/USERGRID-536 f95d39c74 -> 035cb783d


WIP overwrite


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

Branch: refs/heads/USERGRID-536
Commit: fe76d7117bffd6f1ebbe5901677ed36e80ad92a2
Parents: f95d39c
Author: Todd Nine <tnine@apigee.com>
Authored: Thu Apr 9 01:10:53 2015 -0600
Committer: Todd Nine <tnine@apigee.com>
Committed: Thu Apr 9 01:10:53 2015 -0600

----------------------------------------------------------------------
 .../events/EntityVersionDeletedHandler.java     |  3 +-
 .../CollectionResultsLoaderFactoryImpl.java     |  6 +--
 .../ConnectionResultsLoaderFactoryImpl.java     |  6 +--
 .../results/ElasticSearchQueryExecutor.java     | 15 +++---
 .../corepersistence/results/EntityVerifier.java |  2 +-
 .../results/FilteringLoader.java                | 10 ++--
 .../corepersistence/results/ResultsLoader.java  |  2 +-
 .../results/ResultsLoaderFactory.java           |  7 ++-
 .../results/ResultsVerifier.java                |  4 +-
 .../results/VersionVerifier.java                | 12 ++---
 .../corepersistence/util/CpNamingUtils.java     | 50 ++++++++------------
 11 files changed, 52 insertions(+), 65 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/fe76d711/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityVersionDeletedHandler.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityVersionDeletedHandler.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityVersionDeletedHandler.java
index a2e9b30..90d9fdc 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityVersionDeletedHandler.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityVersionDeletedHandler.java
@@ -37,6 +37,7 @@ import org.apache.usergrid.persistence.index.ApplicationEntityIndex;
 import org.apache.usergrid.persistence.index.EntityIndexBatch;
 import org.apache.usergrid.persistence.index.IndexBatchBuffer;
 import org.apache.usergrid.persistence.index.IndexScope;
+import org.apache.usergrid.persistence.index.SearchEdge;
 import org.apache.usergrid.persistence.index.impl.IndexScopeImpl;
 import org.apache.usergrid.persistence.model.entity.Id;
 
@@ -99,7 +100,7 @@ public class EntityVersionDeletedHandler implements EntityVersionDeleted
{
 
         //create an observable of all scopes to deIndex
         //remove all indexes pointing to this
-        final Observable<IndexScope> targetScopes =  edgesObservable.edgesToTarget(
gm, entityId ).map(
+        final Observable<SearchEdge> targetScopes =  edgesObservable.edgesToTarget(
gm, entityId ).map(
             edge -> generateScopeFromSource( edge) );
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/fe76d711/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/CollectionResultsLoaderFactoryImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/CollectionResultsLoaderFactoryImpl.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/CollectionResultsLoaderFactoryImpl.java
index 2f6f96d..2490e7c 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/CollectionResultsLoaderFactoryImpl.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/CollectionResultsLoaderFactoryImpl.java
@@ -21,9 +21,9 @@ package org.apache.usergrid.corepersistence.results;
 
 
 import org.apache.usergrid.corepersistence.ManagerCache;
-import org.apache.usergrid.persistence.core.scope.ApplicationScope;
-import org.apache.usergrid.persistence.index.IndexScope;
 import org.apache.usergrid.persistence.Query;
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
+import org.apache.usergrid.persistence.index.SearchEdge;
 
 
 /**
@@ -40,7 +40,7 @@ public class CollectionResultsLoaderFactoryImpl implements ResultsLoaderFactory
 
 
     @Override
-    public ResultsLoader getLoader( final ApplicationScope applicationScope, final IndexScope
scope, final Query.Level resultsLevel ) {
+    public ResultsLoader getLoader( final ApplicationScope applicationScope, final SearchEdge
scope, final Query.Level resultsLevel ) {
 
         ResultsVerifier verifier;
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/fe76d711/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/ConnectionResultsLoaderFactoryImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/ConnectionResultsLoaderFactoryImpl.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/ConnectionResultsLoaderFactoryImpl.java
index 876cf92..e9633c9 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/ConnectionResultsLoaderFactoryImpl.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/ConnectionResultsLoaderFactoryImpl.java
@@ -22,9 +22,9 @@ package org.apache.usergrid.corepersistence.results;
 
 import org.apache.usergrid.corepersistence.ManagerCache;
 import org.apache.usergrid.persistence.EntityRef;
-import org.apache.usergrid.persistence.core.scope.ApplicationScope;
-import org.apache.usergrid.persistence.index.IndexScope;
 import org.apache.usergrid.persistence.Query;
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
+import org.apache.usergrid.persistence.index.SearchEdge;
 
 
 /**
@@ -46,7 +46,7 @@ public class ConnectionResultsLoaderFactoryImpl implements ResultsLoaderFactory
 
 
     @Override
-    public ResultsLoader getLoader( final ApplicationScope applicationScope, final IndexScope
scope, final Query.Level resultsLevel ) {
+    public ResultsLoader getLoader( final ApplicationScope applicationScope, final SearchEdge
scope, final Query.Level resultsLevel ) {
 
         ResultsVerifier verifier;
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/fe76d711/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/ElasticSearchQueryExecutor.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/ElasticSearchQueryExecutor.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/ElasticSearchQueryExecutor.java
index ae2e350..f2b82ff 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/ElasticSearchQueryExecutor.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/ElasticSearchQueryExecutor.java
@@ -26,14 +26,13 @@ import java.util.NoSuchElementException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import org.apache.usergrid.persistence.Query;
 import org.apache.usergrid.persistence.Results;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.index.ApplicationEntityIndex;
-import org.apache.usergrid.persistence.index.EntityIndex;
-import org.apache.usergrid.persistence.index.IndexScope;
+import org.apache.usergrid.persistence.index.CandidateResults;
+import org.apache.usergrid.persistence.index.SearchEdge;
 import org.apache.usergrid.persistence.index.SearchTypes;
-import org.apache.usergrid.persistence.index.query.CandidateResults;
-import org.apache.usergrid.persistence.Query;
 
 
 public class ElasticSearchQueryExecutor implements QueryExecutor {
@@ -46,7 +45,7 @@ public class ElasticSearchQueryExecutor implements QueryExecutor {
 
     private final ApplicationEntityIndex entityIndex;
 
-    private final IndexScope indexScope;
+    private final SearchEdge indexScope;
 
     private final SearchTypes types;
 
@@ -59,7 +58,7 @@ public class ElasticSearchQueryExecutor implements QueryExecutor {
 
 
     public ElasticSearchQueryExecutor( final ResultsLoaderFactory resultsLoaderFactory, final
ApplicationEntityIndex entityIndex,
-                                       final ApplicationScope applicationScope, final IndexScope
indexScope,
+                                       final ApplicationScope applicationScope, final SearchEdge
indexScope,
                                        final SearchTypes types, final Query query ) {
         this.resultsLoaderFactory = resultsLoaderFactory;
         this.applicationScope = applicationScope;
@@ -95,7 +94,7 @@ public class ElasticSearchQueryExecutor implements QueryExecutor {
 
         while ( !satisfied && queryCount++ < maxQueries ) {
 
-            CandidateResults crs = entityIndex.search( indexScope, types, query );
+            CandidateResults crs = entityIndex.search( indexScope, types, query.getQl(),
query.getLimit() );
 
             logger.debug( "Calling build results 1" );
             results = buildResults( indexScope, query, crs );
@@ -150,7 +149,7 @@ public class ElasticSearchQueryExecutor implements QueryExecutor {
      * @param query Query that was executed
      * @param crs Candidates to be considered for results
      */
-    private Results buildResults( final IndexScope indexScope, final Query query, final CandidateResults
crs ) {
+    private Results buildResults( final SearchEdge indexScope, final Query query, final CandidateResults
crs ) {
 
         logger.debug( "buildResults()  from {} candidates", crs.size() );
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/fe76d711/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/EntityVerifier.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/EntityVerifier.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/EntityVerifier.java
index 075abc4..a2dd5e0 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/EntityVerifier.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/EntityVerifier.java
@@ -38,7 +38,7 @@ import org.apache.usergrid.persistence.Results;
 import org.apache.usergrid.persistence.collection.EntityCollectionManager;
 import org.apache.usergrid.persistence.collection.EntitySet;
 import org.apache.usergrid.persistence.collection.MvccEntity;
-import org.apache.usergrid.persistence.index.query.CandidateResult;
+import org.apache.usergrid.persistence.index.CandidateResult;
 import org.apache.usergrid.persistence.model.entity.Id;
 
 import com.fasterxml.uuid.UUIDComparator;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/fe76d711/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/FilteringLoader.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/FilteringLoader.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/FilteringLoader.java
index c12bb2c..a48e1b8 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/FilteringLoader.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/FilteringLoader.java
@@ -38,9 +38,9 @@ import org.apache.usergrid.persistence.collection.EntityCollectionManager;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.index.ApplicationEntityIndex;
 import org.apache.usergrid.persistence.index.EntityIndexBatch;
-import org.apache.usergrid.persistence.index.IndexScope;
-import org.apache.usergrid.persistence.index.query.CandidateResult;
-import org.apache.usergrid.persistence.index.query.CandidateResults;
+import org.apache.usergrid.persistence.index.SearchEdge;
+import org.apache.usergrid.persistence.index.CandidateResult;
+import org.apache.usergrid.persistence.index.CandidateResults;
 import org.apache.usergrid.persistence.model.entity.Id;
 
 import com.fasterxml.uuid.UUIDComparator;
@@ -55,7 +55,7 @@ public class FilteringLoader implements ResultsLoader {
     private final ManagerCache managerCache;
     private final ResultsVerifier resultsVerifier;
     private final ApplicationScope applicationScope;
-    private final IndexScope indexScope;
+    private final SearchEdge indexScope;
     private final EntityIndexBatch indexBatch;
 
 
@@ -68,7 +68,7 @@ public class FilteringLoader implements ResultsLoader {
      * @param indexScope The index scope used in the search
      */
     protected FilteringLoader( final ManagerCache managerCache, final ResultsVerifier resultsVerifier,
-                               final ApplicationScope applicationScope, final IndexScope
indexScope ) {
+                               final ApplicationScope applicationScope, final SearchEdge
indexScope ) {
 
         this.managerCache = managerCache;
         this.resultsVerifier = resultsVerifier;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/fe76d711/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/ResultsLoader.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/ResultsLoader.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/ResultsLoader.java
index 28df6b6..e8a7bdf 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/ResultsLoader.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/ResultsLoader.java
@@ -21,7 +21,7 @@ package org.apache.usergrid.corepersistence.results;
 
 
 import org.apache.usergrid.persistence.Results;
-import org.apache.usergrid.persistence.index.query.CandidateResults;
+import org.apache.usergrid.persistence.index.CandidateResults;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/fe76d711/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/ResultsLoaderFactory.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/ResultsLoaderFactory.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/ResultsLoaderFactory.java
index 12589e2..3399a35 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/ResultsLoaderFactory.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/ResultsLoaderFactory.java
@@ -20,10 +20,9 @@
 package org.apache.usergrid.corepersistence.results;
 
 
-import org.apache.usergrid.persistence.EntityRef;
-import org.apache.usergrid.persistence.core.scope.ApplicationScope;
-import org.apache.usergrid.persistence.index.IndexScope;
 import org.apache.usergrid.persistence.Query;
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
+import org.apache.usergrid.persistence.index.SearchEdge;
 
 
 /**
@@ -37,6 +36,6 @@ public interface ResultsLoaderFactory {
      * @param indexScope The index scope used in the search
      * @param
      */
-    ResultsLoader getLoader( final ApplicationScope applicationScope, final IndexScope indexScope,
+    ResultsLoader getLoader( final ApplicationScope applicationScope, final SearchEdge indexScope,
                              final Query.Level resultsLevel );
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/fe76d711/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/ResultsVerifier.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/ResultsVerifier.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/ResultsVerifier.java
index 1b92bcc..46e0983 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/ResultsVerifier.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/ResultsVerifier.java
@@ -23,7 +23,7 @@ package org.apache.usergrid.corepersistence.results;
 import java.util.Collection;
 import org.apache.usergrid.persistence.Results;
 import org.apache.usergrid.persistence.collection.EntityCollectionManager;
-import org.apache.usergrid.persistence.index.query.CandidateResult;
+import org.apache.usergrid.persistence.index.CandidateResult;
 import org.apache.usergrid.persistence.model.entity.Id;
 
 
@@ -37,7 +37,7 @@ public interface ResultsVerifier {
     public void loadResults(Collection<Id> ids, EntityCollectionManager ecm);
 
     /**
-     * Return true if the candidate result is a valid result that should be retained. If
it should 
+     * Return true if the candidate result is a valid result that should be retained. If
it should
      * not it should also be removed from the list of possible return values in this loader
      * @param candidateResult
      */

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/fe76d711/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/VersionVerifier.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/VersionVerifier.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/VersionVerifier.java
index c541550..574ba55 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/VersionVerifier.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/VersionVerifier.java
@@ -29,7 +29,7 @@ import org.slf4j.LoggerFactory;
 import org.apache.usergrid.persistence.collection.EntityCollectionManager;
 import org.apache.usergrid.persistence.collection.MvccLogEntry;
 import org.apache.usergrid.persistence.collection.VersionSet;
-import org.apache.usergrid.persistence.index.query.CandidateResult;
+import org.apache.usergrid.persistence.index.CandidateResult;
 import org.apache.usergrid.persistence.model.entity.Id;
 
 import com.fasterxml.uuid.UUIDComparator;
@@ -59,7 +59,7 @@ public abstract class VersionVerifier implements ResultsVerifier {
 
         //version wasn't found ,deindex
         if ( version == null ) {
-            logger.warn( "Version for Entity {}:{} not found", 
+            logger.warn( "Version for Entity {}:{} not found",
                     entityId.getUuid(), entityId.getUuid() );
 
             return false;
@@ -69,10 +69,10 @@ public abstract class VersionVerifier implements ResultsVerifier {
 
         if ( UUIDComparator.staticCompare( savedVersion, candidateResult.getVersion() ) >
0 ) {
             logger.debug( "Stale version of Entity uuid:{} type:{}, stale v:{}, latest v:{}",
-                new Object[] { 
-                    entityId.getUuid(), 
-                    entityId.getType(), 
-                    candidateResult.getVersion(), 
+                new Object[] {
+                    entityId.getUuid(),
+                    entityId.getType(),
+                    candidateResult.getVersion(),
                     savedVersion
             } );
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/fe76d711/stack/core/src/main/java/org/apache/usergrid/corepersistence/util/CpNamingUtils.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/util/CpNamingUtils.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/util/CpNamingUtils.java
index 49929dc..47362a9 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/util/CpNamingUtils.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/util/CpNamingUtils.java
@@ -27,8 +27,10 @@ import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.core.scope.ApplicationScopeImpl;
 import org.apache.usergrid.persistence.entities.Application;
 import org.apache.usergrid.persistence.graph.Edge;
-import org.apache.usergrid.persistence.index.IndexScope;
-import org.apache.usergrid.persistence.index.impl.IndexScopeImpl;
+import org.apache.usergrid.persistence.graph.serialization.impl.shard.NodeType;
+import org.apache.usergrid.persistence.index.IndexEdge;
+import org.apache.usergrid.persistence.index.SearchEdge;
+import org.apache.usergrid.persistence.index.impl.IndexEdgeImpl;
 import org.apache.usergrid.persistence.map.MapScope;
 import org.apache.usergrid.persistence.map.impl.MapScopeImpl;
 import org.apache.usergrid.persistence.model.entity.Id;
@@ -84,16 +86,16 @@ public class CpNamingUtils {
     }
 
 
-    private static String getCollectionScopeNameFromCollectionName( String name ) {
-        String csn = EDGE_COLL_SUFFIX + name;
-        return csn.toLowerCase();
-    }
-
-
-    private static String getConnectionScopeName( String connectionType ) {
-        String csn = EDGE_CONN_SUFFIX + connectionType ;
-        return csn.toLowerCase();
-    }
+//    private static String getCollectionScopeNameFromCollectionName( String name ) {
+//        String csn = EDGE_COLL_SUFFIX + name;
+//        return csn.toLowerCase();
+//    }
+//
+//
+//    private static String getConnectionScopeName( String connectionType ) {
+//        String csn = EDGE_CONN_SUFFIX + connectionType ;
+//        return csn.toLowerCase();
+//    }
 
 
     /**
@@ -101,15 +103,8 @@ public class CpNamingUtils {
      * @param edge
      * @return
      */
-    public static IndexScope generateScopeFromSource(final Edge edge ){
-
-
-        final Id nodeId = edge.getSourceNode();
-        final String scopeName = getNameFromEdgeType( edge.getType() );
-
-
-        return new IndexScopeImpl( nodeId, scopeName );
-
+    public static IndexEdge generateScopeFromSource(final Edge edge ){
+        return new IndexEdgeImpl( edge.getSourceNode(), edge.getType(), SearchEdge.NodeType.SOURCE,
edge.getTimestamp() );
     }
 
 
@@ -121,15 +116,8 @@ public class CpNamingUtils {
      * @param edge
      * @return
      */
-    public static IndexScope generateScopeToTarget(final Edge edge ){
-
-
-
-        final Id nodeId = edge.getTargetNode();
-        final String scopeName = getNameFromEdgeType( edge.getType() );
-
-
-        return new IndexScopeImpl( nodeId, scopeName );
+    public static IndexEdge generateScopeToTarget(final Edge edge ){
+                return new IndexEdgeImpl( edge.getTargetNode(), edge.getType(), SearchEdge.NodeType.TARGET,
edge.getTimestamp() );
 
     }
 
@@ -157,7 +145,7 @@ public class CpNamingUtils {
      * @param collectionName The name of the collection.  Ex "users"
      * @return
      */
-    public static IndexScope generateScopeFromCollection( final Id nodeId, final String collectionName
){
+    public static SearchEdge generateScopeFromCollection( final Id nodeId, final String collectionName
){
         return new IndexScopeImpl( nodeId, getCollectionScopeNameFromCollectionName( collectionName
) );
     }
 


Mime
View raw message