usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mru...@apache.org
Subject usergrid git commit: Rename the cluster authoritative region parameters/methods to be more specific.
Date Thu, 01 Sep 2016 18:27:03 GMT
Repository: usergrid
Updated Branches:
  refs/heads/hotfix-20160819 f4b7ac6c1 -> c97a20041


Rename the cluster authoritative region parameters/methods to be more specific.


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

Branch: refs/heads/hotfix-20160819
Commit: c97a20041b5b7bc846648e19b549b7ecb5bf350b
Parents: f4b7ac6
Author: Michael Russo <mrusso@apigee.com>
Authored: Thu Sep 1 11:26:37 2016 -0700
Committer: Michael Russo <mrusso@apigee.com>
Committed: Thu Sep 1 11:26:37 2016 -0700

----------------------------------------------------------------------
 .../corepersistence/CpEntityManager.java        | 21 ++++++++++----------
 .../mvcc/stage/CollectionIoEvent.java           | 10 +++++-----
 .../mvcc/stage/delete/MarkCommit.java           |  2 +-
 .../mvcc/stage/write/WriteCommit.java           | 12 +++++------
 .../mvcc/stage/write/WriteUniqueVerify.java     | 12 +++++------
 5 files changed, 29 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/c97a2004/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
index 7b273e4..87a8649 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
@@ -106,6 +106,7 @@ public class CpEntityManager implements EntityManager {
     public static final String APPLICATION_COLLECTION = "application.collection.";
     public static final String APPLICATION_ENTITIES = "application.entities";
     public static final long ONE_COUNT = 1L;
+    public static final String AUTHORITATIVE_REGION_SETTING = "authoritativeRegion";
 
     private final UUID applicationId;
     private final EntityManagerFig entityManagerFig;
@@ -522,7 +523,7 @@ public class CpEntityManager implements EntityManager {
 
         try {
 
-            String region = lookupRegionForType( entity.getType() );
+            String region = lookupAuthoritativeRegionForType( entity.getType() );
 
             cpEntity = ecm.write( cpEntity, region ).toBlocking().last();
 
@@ -625,7 +626,7 @@ public class CpEntityManager implements EntityManager {
         Id entityId = new SimpleId( entityRef.getUuid(), entityRef.getType() );
 
         //Step 1 & 2 of delete
-        String region = this.lookupRegionForType( entityRef.getType() );
+        String region = this.lookupAuthoritativeRegionForType( entityRef.getType() );
         return ecm.mark( entityId, region ).mergeWith( gm.markNode( entityId, createGraphOperationTimestamp()
) );
 
     }
@@ -1138,7 +1139,7 @@ public class CpEntityManager implements EntityManager {
         Optional<Map<String, Object>> existingSettings =
             collectionSettings.getCollectionSettings( collectionName );
         if ( existingSettings.isPresent() ) {
-            region = existingSettings.get().get("region").toString();
+            region = existingSettings.get().get(AUTHORITATIVE_REGION_SETTING).toString();
         }
 
         //TODO: does this call and others like it need a graphite reporter?
@@ -1818,12 +1819,12 @@ public class CpEntityManager implements EntityManager {
         }
 
         // if region specified
-        Object region = newSettings.get("region");
+        Object region = newSettings.get(AUTHORITATIVE_REGION_SETTING);
         if ( region != null ) {
 
             // passing an empty string causes region to be removed from settings
             if ( region.toString().trim().isEmpty() ) {
-                updatedSettings.remove("region");
+                updatedSettings.remove(AUTHORITATIVE_REGION_SETTING);
 
             } else {
                 // make sure region is in the configured region list
@@ -1831,7 +1832,7 @@ public class CpEntityManager implements EntityManager {
                 if (!regionList.contains( region )) {
                     throw new NullArgumentException( "Region " + region + " not in region
list" );
                 }
-                updatedSettings.put("region", region);
+                updatedSettings.put(AUTHORITATIVE_REGION_SETTING, region);
             }
         }
 
@@ -2827,7 +2828,7 @@ public class CpEntityManager implements EntityManager {
                     cpEntity.getId().getType(), cpEntity.getId().getUuid(), cpEntity.getVersion()
);
             }
 
-            String region = lookupRegionForType( entity.getType() );
+            String region = lookupAuthoritativeRegionForType( entity.getType() );
 
             //this does the write so before adding to a collection everything already exists
already.
             cpEntity = ecm.write( cpEntity, region ).toBlocking().last();
@@ -3138,7 +3139,7 @@ public class CpEntityManager implements EntityManager {
     }
 
 
-    private  String lookupRegionForType( String type ) {
+    private  String lookupAuthoritativeRegionForType(String type ) {
 
         String region = null;
         String collectionName = Schema.defaultCollectionName( type );
@@ -3151,8 +3152,8 @@ public class CpEntityManager implements EntityManager {
         Optional<Map<String, Object>> existingSettings =
             collectionSettings.getCollectionSettings( collectionName );
 
-        if ( existingSettings.isPresent() && existingSettings.get().get("region")
!= null ) {
-            region = existingSettings.get().get("region").toString();
+        if ( existingSettings.isPresent() && existingSettings.get().get(AUTHORITATIVE_REGION_SETTING)
!= null ) {
+            region = existingSettings.get().get(AUTHORITATIVE_REGION_SETTING).toString();
         }
 
         return region;

http://git-wip-us.apache.org/repos/asf/usergrid/blob/c97a2004/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/CollectionIoEvent.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/CollectionIoEvent.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/CollectionIoEvent.java
index e0388de..4116f25 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/CollectionIoEvent.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/CollectionIoEvent.java
@@ -33,16 +33,16 @@ public class CollectionIoEvent<T> implements Serializable {
 
     final private T event;
 
-    final private String region;
+    final private String authoritativeRegion;
 
     public CollectionIoEvent( final ApplicationScope context, final T event ) {
         this( context, event, null );
     }
 
-    public CollectionIoEvent( final ApplicationScope context, final T event, String region
) {
+    public CollectionIoEvent( final ApplicationScope context, final T event, String authoritativeRegion
) {
         this.context = context;
         this.event = event;
-        this.region = region;
+        this.authoritativeRegion = authoritativeRegion;
     }
 
 
@@ -55,7 +55,7 @@ public class CollectionIoEvent<T> implements Serializable {
         return event;
     }
 
-    public String getRegion() {
-        return region;
+    public String getAuthoritativeRegion() {
+        return authoritativeRegion;
     }
 }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/c97a2004/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/delete/MarkCommit.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/delete/MarkCommit.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/delete/MarkCommit.java
index 57d92e1..c79f072 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/delete/MarkCommit.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/delete/MarkCommit.java
@@ -131,7 +131,7 @@ public class MarkCommit implements Action1<CollectionIoEvent<MvccEntity>>
{
 //        // actorSystemFig may be null in testing
 //        if ( actorSystemFig != null && actorSystemFig.getEnabled() ) {
 //
-//            String region = idIoEvent.getRegion();
+//            String region = idIoEvent.getAuthoritativeRegion();
 //            if ( region == null ) {
 //                region = uniqueValuesFig.getAuthoritativeRegion();
 //            }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/c97a2004/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteCommit.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteCommit.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteCommit.java
index 553ac4c..9d376f9 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteCommit.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteCommit.java
@@ -136,14 +136,14 @@ public class WriteCommit implements Func1<CollectionIoEvent<MvccEntity>,
Collect
 
         // akkaFig may be null when this is called from JUnit tests
         if ( actorSystemFig != null && actorSystemFig.getEnabled() ) {
-            String region = ioEvent.getRegion();
-            if ( StringUtils.isEmpty(region) ) {
-                region = uniqueValuesFig.getAuthoritativeRegion();
+            String authoritativeRegion = ioEvent.getAuthoritativeRegion();
+            if ( StringUtils.isEmpty(authoritativeRegion) ) {
+                authoritativeRegion = uniqueValuesFig.getAuthoritativeRegion();
             }
-            if ( StringUtils.isEmpty(region) ) {
-                region = actorSystemFig.getRegionLocal();
+            if ( StringUtils.isEmpty(authoritativeRegion) ) {
+                authoritativeRegion = actorSystemFig.getRegionLocal();
             }
-            confirmUniqueFieldsAkka( mvccEntity, version, applicationScope, region );
+            confirmUniqueFieldsAkka( mvccEntity, version, applicationScope, authoritativeRegion
);
         } else {
             confirmUniqueFields( mvccEntity, version, applicationScope, logMutation );
         }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/c97a2004/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerify.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerify.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerify.java
index 0832074..c51c742 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerify.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerify.java
@@ -124,15 +124,15 @@ public class WriteUniqueVerify implements Action1<CollectionIoEvent<MvccEntity>>
 
         final ApplicationScope applicationScope = ioevent.getEntityCollection();
 
-        String region = ioevent.getRegion();
-        if ( StringUtils.isEmpty(region) ) {
-            region = uniqueValuesFig.getAuthoritativeRegion();
+        String authoritativeRegion = ioevent.getAuthoritativeRegion();
+        if ( StringUtils.isEmpty(authoritativeRegion) ) {
+            authoritativeRegion = uniqueValuesFig.getAuthoritativeRegion();
         }
-        if ( StringUtils.isEmpty(region) ) {
-            region = actorSystemFig.getRegionLocal();
+        if ( StringUtils.isEmpty(authoritativeRegion) ) {
+            authoritativeRegion = actorSystemFig.getRegionLocal();
         }
         try {
-            akkaUvService.reserveUniqueValues( applicationScope, entity, mvccEntity.getVersion(),
region );
+            akkaUvService.reserveUniqueValues( applicationScope, entity, mvccEntity.getVersion(),
authoritativeRegion );
 
         } catch (UniqueValueException e) {
             Map<String, Field> violations = new HashMap<>();


Mime
View raw message