usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject usergrid git commit: queue up deletes
Date Thu, 03 Sep 2015 19:59:03 GMT
Repository: usergrid
Updated Branches:
  refs/heads/USERGRID-938 09e818361 -> 10149d740


queue up deletes


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

Branch: refs/heads/USERGRID-938
Commit: 10149d740349cf37fbab0099f19379f2842c655a
Parents: 09e8183
Author: Shawn Feldman <sfeldman@apache.org>
Authored: Thu Sep 3 13:58:59 2015 -0600
Committer: Shawn Feldman <sfeldman@apache.org>
Committed: Thu Sep 3 13:58:59 2015 -0600

----------------------------------------------------------------------
 .../usergrid/corepersistence/service/ApplicationService.java  | 3 ++-
 .../corepersistence/service/ApplicationServiceImpl.java       | 7 ++++---
 .../main/java/org/apache/usergrid/rest/SystemResource.java    | 1 +
 .../org/apache/usergrid/management/ManagementService.java     | 3 ++-
 .../usergrid/management/cassandra/ManagementServiceImpl.java  | 3 ++-
 5 files changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/10149d74/stack/core/src/main/java/org/apache/usergrid/corepersistence/service/ApplicationService.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/service/ApplicationService.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/service/ApplicationService.java
index 18b1e60..73547a7 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/service/ApplicationService.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/service/ApplicationService.java
@@ -20,6 +20,7 @@
 package org.apache.usergrid.corepersistence.service;
 
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
+import org.apache.usergrid.persistence.model.entity.Id;
 import rx.Observable;
 
 /**
@@ -27,5 +28,5 @@ import rx.Observable;
  */
 public interface ApplicationService {
 
-    Observable<Integer> deleteAllEntities(ApplicationScope applicationScope);
+    Observable<Id> deleteAllEntities(ApplicationScope applicationScope);
 }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/10149d74/stack/core/src/main/java/org/apache/usergrid/corepersistence/service/ApplicationServiceImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/service/ApplicationServiceImpl.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/service/ApplicationServiceImpl.java
index 0becab4..72dd677 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/service/ApplicationServiceImpl.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/service/ApplicationServiceImpl.java
@@ -24,6 +24,7 @@ import org.apache.usergrid.corepersistence.asyncevents.EventBuilder;
 import org.apache.usergrid.corepersistence.rx.impl.AllEntityIdsObservable;
 import org.apache.usergrid.corepersistence.util.CpNamingUtils;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
+import org.apache.usergrid.persistence.model.entity.Id;
 import rx.Observable;
 
 /**
@@ -42,7 +43,7 @@ public class ApplicationServiceImpl  implements ApplicationService{
         this.eventBuilder = eventBuilder;
     }
     @Override
-    public Observable<Integer> deleteAllEntities(ApplicationScope applicationScope)
{
+    public Observable<Id> deleteAllEntities(ApplicationScope applicationScope) {
         if(applicationScope.getApplication().getUuid().equals(CpNamingUtils.MANAGEMENT_APPLICATION_ID)){
             throw new IllegalArgumentException("Can't delete from management app");
         }
@@ -51,10 +52,10 @@ public class ApplicationServiceImpl  implements ApplicationService{
         Observable appObservable  = Observable.just(applicationScope);
 
 
-        Observable<Integer> countObservable = allEntityIdsObservable.getEntities(appObservable)
+        Observable<Id> countObservable = allEntityIdsObservable.getEntities(appObservable)
             //.map(entity -> eventBuilder.buildEntityDelete(applicationScope, entity.getId()).getEntitiesCompacted())
             .doOnNext(entity -> asyncEventService.queueEntityDelete(applicationScope,
entity.getId()))
-            .count();
+            .map(entityIdScope -> entityIdScope.getId());
         return countObservable;
     }
 }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/10149d74/stack/rest/src/main/java/org/apache/usergrid/rest/SystemResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/SystemResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/SystemResource.java
index ace8fd0..20f0fa4 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/SystemResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/SystemResource.java
@@ -99,6 +99,7 @@ public class SystemResource extends AbstractContextResource {
         AtomicInteger itemsDeleted = new AtomicInteger(0);
         try {
              management.deleteAllEntities(applicationId)
+             .count()
              .doOnNext(count -> itemsDeleted.set(count))
              .toBlocking().lastOrDefault(0);
         }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/10149d74/stack/services/src/main/java/org/apache/usergrid/management/ManagementService.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/management/ManagementService.java
b/stack/services/src/main/java/org/apache/usergrid/management/ManagementService.java
index 4b05b94..25a693b 100644
--- a/stack/services/src/main/java/org/apache/usergrid/management/ManagementService.java
+++ b/stack/services/src/main/java/org/apache/usergrid/management/ManagementService.java
@@ -30,6 +30,7 @@ import org.apache.usergrid.persistence.index.query.Identifier;
 import org.apache.usergrid.persistence.entities.Application;
 import org.apache.usergrid.persistence.entities.Group;
 import org.apache.usergrid.persistence.entities.User;
+import org.apache.usergrid.persistence.model.entity.Id;
 import org.apache.usergrid.security.oauth.AccessInfo;
 import org.apache.usergrid.security.shiro.PrincipalCredentialsToken;
 import org.apache.usergrid.services.ServiceResults;
@@ -345,5 +346,5 @@ public interface ManagementService {
      * @param applicationId
      * @return
      */
-    Observable<Integer> deleteAllEntities(UUID applicationId);
+    Observable<Id> deleteAllEntities(UUID applicationId);
 }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/10149d74/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
b/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
index 437b1a4..1ef5659 100644
--- a/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
+++ b/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
@@ -48,6 +48,7 @@ import org.apache.usergrid.persistence.exceptions.ApplicationAlreadyExistsExcept
 import org.apache.usergrid.persistence.exceptions.DuplicateUniquePropertyExistsException;
 import org.apache.usergrid.persistence.exceptions.EntityNotFoundException;
 import org.apache.usergrid.persistence.index.query.Identifier;
+import org.apache.usergrid.persistence.model.entity.Id;
 import org.apache.usergrid.security.AuthPrincipalInfo;
 import org.apache.usergrid.security.AuthPrincipalType;
 import org.apache.usergrid.security.crypto.EncryptionService;
@@ -3067,7 +3068,7 @@ public class ManagementServiceImpl implements ManagementService {
     }
 
     @Override
-    public Observable<Integer> deleteAllEntities(UUID applicationId){
+    public Observable<Id> deleteAllEntities(UUID applicationId){
         if(applicationId.equals(CpNamingUtils.MANAGEMENT_APPLICATION_ID)){
             throw new IllegalArgumentException("Can't delete from management app");
         }


Mime
View raw message