You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by to...@apache.org on 2015/03/27 16:41:38 UTC

[3/7] incubator-usergrid git commit: First pass of changing interface to only use ApplicationScope. Implementation should be legacy compatible

First pass of changing interface to only use ApplicationScope.  Implementation should be legacy compatible


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

Branch: refs/heads/USERGRID-509
Commit: c39be5dad80968744ac12c0fe3710fe7d33f3593
Parents: 6db7ce9
Author: Todd Nine <tn...@apigee.com>
Authored: Thu Mar 26 16:50:09 2015 -0600
Committer: Todd Nine <tn...@apigee.com>
Committed: Thu Mar 26 16:50:09 2015 -0600

----------------------------------------------------------------------
 .../collection/EntityCollectionManager.java     |  47 ++-
 .../EntityCollectionManagerFactory.java         |  13 +-
 .../cache/CachedEntityCollectionManager.java    |   9 +-
 .../exception/CollectionRuntimeException.java   |  30 +-
 .../exception/EntityTooLargeException.java      |   6 +-
 .../exception/WriteCommitException.java         |  11 +-
 .../WriteOptimisticVerifyException.java         |  10 +-
 .../exception/WriteStartException.java          |  10 +-
 .../exception/WriteUniqueVerifyException.java   |   6 +-
 .../EntityCollectionManagerFactoryImpl.java     |  18 +-
 .../impl/EntityCollectionManagerImpl.java       |  41 +-
 .../collection/impl/EntityDeletedTask.java      |   6 +-
 .../impl/EntityVersionCleanupTask.java          |   2 +-
 .../impl/EntityVersionTaskFactory.java          |  10 +-
 .../mvcc/MvccLogEntrySerializationStrategy.java |  80 ----
 .../mvcc/stage/CollectionIoEvent.java           |   7 +-
 .../mvcc/stage/delete/MarkCommit.java           |   9 +-
 .../collection/mvcc/stage/delete/MarkStart.java |  15 +-
 .../mvcc/stage/write/RollbackAction.java        |   5 +-
 .../mvcc/stage/write/WriteCommit.java           |  13 +-
 .../mvcc/stage/write/WriteOptimisticVerify.java |   9 +-
 .../collection/mvcc/stage/write/WriteStart.java |  13 +-
 .../mvcc/stage/write/WriteUniqueVerify.java     |  21 +-
 .../MvccEntitySerializationStrategy.java        |  15 +-
 .../MvccLogEntrySerializationStrategy.java      |  81 ++++
 .../UniqueValueSerializationStrategy.java       |  23 +-
 .../serialization/impl/LogEntryIterator.java    |   2 +-
 .../MvccEntitySerializationStrategyImpl.java    |  66 ++--
 ...vccEntitySerializationStrategyProxyImpl.java |  16 +-
 .../MvccEntitySerializationStrategyV3Impl.java  |  52 +--
 .../MvccLogEntrySerializationStrategyImpl.java  |  31 +-
 .../serialization/impl/SerializationModule.java |   2 +-
 .../UniqueValueSerializationStrategyImpl.java   |  61 +--
 .../serialization/impl/util/Inflector.java      | 370 +++++++++++++++++++
 .../impl/util/LegacyScopeUtils.java             |  57 +++
 .../impl/EntityVersionCleanupTaskTest.java      |  11 +-
 .../mvcc/stage/delete/MarkCommitTest.java       |   2 +-
 .../mvcc/stage/delete/MarkStartTest.java        |   2 +-
 .../mvcc/stage/write/WriteCommitTest.java       |   2 +-
 .../stage/write/WriteOptimisticVerifyTest.java  |  14 +-
 .../mvcc/stage/write/WriteStartTest.java        |   2 +-
 .../impl/LogEntryIteratorTest.java              |   2 +-
 .../impl/MvccLESSTransientTest.java             |   6 +-
 ...ccLogEntrySerializationStrategyImplTest.java |   2 +-
 .../collection/util/LogEntryMock.java           |   3 +-
 .../collection/util/UniqueValueEntryMock.java   |  10 -
 46 files changed, 845 insertions(+), 378 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c39be5da/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/EntityCollectionManager.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/EntityCollectionManager.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/EntityCollectionManager.java
index 6532ee6..d4232ca 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/EntityCollectionManager.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/EntityCollectionManager.java
@@ -35,50 +35,69 @@ public interface EntityCollectionManager {
     /**
      * Write the entity in the entity collection.  This is an entire entity, it's contents will
      * completely overwrite the previous values, if it exists.
+     *
      * @param entity The entity to update
+     *
+     * @return the Observable with the updated entity in the body
      */
-    public Observable<Entity> write( Entity entity );
+    Observable<Entity> write( Entity entity );
 
 
     /**
-     * MarkCommit the entity and remove it's indexes with the given entity id
+     * @param entityId MarkCommit the entity as deleted
+     *
+     * @return The observable of the id after the operation has completed
      */
-    public Observable<Id> delete( Id entityId );
+    Observable<Id> delete( Id entityId );
 
     /**
+     * @param entityId The entity id to load.
+     *
+     * @return The observable with the entity
+     *
      * Load the entity with the given entity Id
      */
-    public Observable<Entity> load( Id entityId );
+    Observable<Entity> load( Id entityId );
 
     /**
+     * @param entityIds Returns a version set with the latest version for each of the entities
      * Return the latest versions of the specified entityIds
+     *
+     * @return A versionset that has all the latest versions for the specified Ids that could be found
      */
-    public Observable<VersionSet> getLatestVersion( Collection<Id> entityId );
+    Observable<VersionSet> getLatestVersion( Collection<Id> entityIds );
 
 
-    public Observable<FieldSet> getEntitiesFromFields( Collection<Field> fields );
+    /**
+     * Get a fieldset of all fields from the entities
+     * @param entityType The type of entity.  From the "type" field in the id.
+     * @param fields The collection of fields to search
+     * @return
+     */
+    Observable<FieldSet> getEntitiesFromFields( String entityType, Collection<Field> fields );
 
     /**
      * Gets the Id for a field
+     * @param entityType the type field from the Id object
+     * @param field The field to search for
+     *
      * @return most likely a single Id, watch for onerror events
      */
-    public Observable<Id> getIdField(final Field field);
+    Observable<Id> getIdField( String entityType, Field field );
 
-    /**
-     * Audit a unique field, and remove any stale entries in the system
-     * @param field The field to audit within this collection scope.
 
-    public Observable<Integer> auditUniqueField(final Field field);
-     */
     /**
+     * @param entityIds The entityIds for loading a collection
      * Load all the entityIds into the observable entity set
+     *
+     * @return An EntitySet with the latest data of every entity that could be located
      */
-    public Observable<EntitySet> load(Collection<Id> entityIds);
+    Observable<EntitySet> load( Collection<Id> entityIds );
 
 
     /**
      * Returns health of entity data store.
      */
-    public Health getHealth();
+    Health getHealth();
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c39be5da/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerFactory.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerFactory.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerFactory.java
index 16045ed..1d6f45e 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerFactory.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerFactory.java
@@ -19,6 +19,9 @@
 package org.apache.usergrid.persistence.collection;
 
 
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
+
+
 /**
  * A basic factory that creates a collection manager with the given context.
  * Each instance of this factory should exist for a Single ApplicationScope
@@ -31,13 +34,13 @@ public interface EntityCollectionManagerFactory {
      * and will shard responses.  The returned instance should not be shared
      * among threads it will not be guaranteed to be thread safe.
      *
-     * @param collectionScope The collectionScope collectionScope to use
-     * when creating the collectionScope manager
+     * @param applicationScope The applicationScope to use
+     * when creating the EntityCollectionManager
      *
-     * @return The collectionScope manager to perform operations within the provided context
+     * @return The EntityCollectionManager to perform operations within the applicationscope provided
      */
-    public EntityCollectionManager
-        createCollectionManager( CollectionScope collectionScope );
+    EntityCollectionManager
+        createCollectionManager( ApplicationScope applicationScope );
 
 
     void invalidate();

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c39be5da/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/cache/CachedEntityCollectionManager.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/cache/CachedEntityCollectionManager.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/cache/CachedEntityCollectionManager.java
index 955f0b7..57dcc79 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/cache/CachedEntityCollectionManager.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/cache/CachedEntityCollectionManager.java
@@ -70,8 +70,8 @@ public class CachedEntityCollectionManager implements EntityCollectionManager {
     }
 
     @Override
-    public Observable<FieldSet> getEntitiesFromFields( final Collection<Field> fields ) {
-        return targetEntityCollectionManager.getEntitiesFromFields( fields );
+    public Observable<FieldSet> getEntitiesFromFields(  final String entityType, final Collection<Field> fields) {
+        return targetEntityCollectionManager.getEntitiesFromFields( entityType, fields );
     }
 
     @Override
@@ -110,9 +110,10 @@ public class CachedEntityCollectionManager implements EntityCollectionManager {
     }
 
 
+
     @Override
-    public Observable<Id> getIdField( final Field field ) {
-        return targetEntityCollectionManager.getIdField( field );
+    public Observable<Id> getIdField( final String entityType,  final Field field ) {
+        return targetEntityCollectionManager.getIdField( entityType, field );
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c39be5da/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/CollectionRuntimeException.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/CollectionRuntimeException.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/CollectionRuntimeException.java
index 416cb9f..431122e 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/CollectionRuntimeException.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/CollectionRuntimeException.java
@@ -17,53 +17,53 @@
  */
 package org.apache.usergrid.persistence.collection.exception;
 
-import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.MvccEntity;
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 
 
 public class CollectionRuntimeException extends RuntimeException {
 
     private MvccEntity entity;
-    private CollectionScope collectionScope;
+    private ApplicationScope applicationScope;
 
 
-    public CollectionRuntimeException( MvccEntity entity, CollectionScope scope, final String message ) {
-        super( message ); 
+    public CollectionRuntimeException( MvccEntity entity, ApplicationScope scope, final String message ) {
+        super( message );
         this.entity = entity;
-        this.collectionScope = scope; 
+        this.applicationScope = scope;
     }
 
 
-    public CollectionRuntimeException( MvccEntity entity, CollectionScope scope, final String message, final Throwable cause ) {
+    public CollectionRuntimeException( MvccEntity entity, ApplicationScope scope, final String message, final Throwable cause ) {
         super( message, cause );
         this.entity = entity;
-        this.collectionScope = scope; 
+        this.applicationScope = scope;
     }
 
 
-    public CollectionRuntimeException( MvccEntity entity, CollectionScope scope, final Throwable cause ) {
+    public CollectionRuntimeException( MvccEntity entity, ApplicationScope scope, final Throwable cause ) {
         super( cause );
         this.entity = entity;
-        this.collectionScope = scope; 
+        this.applicationScope = scope;
     }
 
 
-    public CollectionRuntimeException( MvccEntity entity, CollectionScope scope,
+    public CollectionRuntimeException( MvccEntity entity, ApplicationScope scope,
             final String message, final Throwable cause, final boolean enableSuppression,
             final boolean writableStackTrace ) {
         super( message, cause, enableSuppression, writableStackTrace );
         this.entity = entity;
-        this.collectionScope = scope; 
+        this.applicationScope = scope;
     }
 
-    
-    public CollectionScope getCollectionScope() {
-        return collectionScope;
+
+    public ApplicationScope getApplicationScope() {
+        return applicationScope;
     }
 
     /**
      * Entity involved in operation.
-     * @return Entity or null if entity not instantiated yet in operation. 
+     * @return Entity or null if entity not instantiated yet in operation.
      */
     public MvccEntity getEntity() {
         return entity;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c39be5da/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/EntityTooLargeException.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/EntityTooLargeException.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/EntityTooLargeException.java
index 11224db..6ba3001 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/EntityTooLargeException.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/EntityTooLargeException.java
@@ -18,11 +18,11 @@
  */
 package org.apache.usergrid.persistence.collection.exception;
 
-import org.apache.usergrid.persistence.collection.CollectionScope;
-import org.apache.usergrid.persistence.collection.MvccEntity;
+
 import org.apache.usergrid.persistence.model.entity.Entity;
 
 
+
 public class EntityTooLargeException extends RuntimeException {
 
     private final Entity entity;
@@ -59,7 +59,7 @@ public class EntityTooLargeException extends RuntimeException {
 
     /**
      * Entity involved in operation.
-     * @return Entity or null if entity not instantiated yet in operation. 
+     * @return Entity or null if entity not instantiated yet in operation.
      */
     public Entity getEntity() {
         return entity;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c39be5da/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/WriteCommitException.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/WriteCommitException.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/WriteCommitException.java
index b0b8b9c..426502e 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/WriteCommitException.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/WriteCommitException.java
@@ -17,28 +17,29 @@
  */
 package org.apache.usergrid.persistence.collection.exception;
 
-import org.apache.usergrid.persistence.collection.CollectionScope;
+
 import org.apache.usergrid.persistence.collection.MvccEntity;
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 
 
 public class WriteCommitException extends CollectionRuntimeException {
 
-    public WriteCommitException( MvccEntity entity, CollectionScope scope, final String message ) {
+    public WriteCommitException( MvccEntity entity, ApplicationScope scope, final String message ) {
         super( entity, scope, message );
     }
 
 
-    public WriteCommitException( MvccEntity entity, CollectionScope scope, final String message, final Throwable cause ) {
+    public WriteCommitException( MvccEntity entity, ApplicationScope scope, final String message, final Throwable cause ) {
         super( entity, scope, message, cause );
     }
 
 
-    public WriteCommitException( MvccEntity entity, CollectionScope scope, final Throwable cause ) {
+    public WriteCommitException( MvccEntity entity, ApplicationScope scope, final Throwable cause ) {
         super( entity, scope, cause );
     }
 
 
-    public WriteCommitException( MvccEntity entity, CollectionScope scope, final String message, final Throwable cause, final boolean enableSuppression,
+    public WriteCommitException( MvccEntity entity, ApplicationScope scope, final String message, final Throwable cause, final boolean enableSuppression,
                                        final boolean writableStackTrace ) {
         super( entity, scope, message, cause, enableSuppression, writableStackTrace );
     }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c39be5da/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/WriteOptimisticVerifyException.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/WriteOptimisticVerifyException.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/WriteOptimisticVerifyException.java
index ca9c7aa..0badc42 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/WriteOptimisticVerifyException.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/WriteOptimisticVerifyException.java
@@ -17,29 +17,29 @@
  */
 package org.apache.usergrid.persistence.collection.exception;
 
-import org.apache.usergrid.persistence.collection.CollectionScope;
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.collection.MvccEntity;
 
 
 public class WriteOptimisticVerifyException extends CollectionRuntimeException {
 
 
-    public WriteOptimisticVerifyException( MvccEntity entity, CollectionScope scope, final String message ) {
+    public WriteOptimisticVerifyException( MvccEntity entity, ApplicationScope scope, final String message ) {
         super( entity, scope, message );
     }
 
 
-    public WriteOptimisticVerifyException( MvccEntity entity, CollectionScope scope, final String message, final Throwable cause ) {
+    public WriteOptimisticVerifyException( MvccEntity entity, ApplicationScope scope, final String message, final Throwable cause ) {
         super( entity, scope, message, cause );
     }
 
 
-    public WriteOptimisticVerifyException( MvccEntity entity, CollectionScope scope, final Throwable cause ) {
+    public WriteOptimisticVerifyException( MvccEntity entity, ApplicationScope scope, final Throwable cause ) {
         super( entity, scope, cause );
     }
 
 
-    public WriteOptimisticVerifyException( MvccEntity entity, CollectionScope scope,
+    public WriteOptimisticVerifyException( MvccEntity entity, ApplicationScope scope,
             final String message, final Throwable cause, final boolean enableSuppression,
             final boolean writableStackTrace ) {
         super( entity, scope, message, cause, enableSuppression, writableStackTrace );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c39be5da/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/WriteStartException.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/WriteStartException.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/WriteStartException.java
index f8a90df..27f029b 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/WriteStartException.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/WriteStartException.java
@@ -17,29 +17,29 @@
  */
 package org.apache.usergrid.persistence.collection.exception;
 
-import org.apache.usergrid.persistence.collection.CollectionScope;
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.collection.MvccEntity;
 
 
 public class WriteStartException extends CollectionRuntimeException {
 
 
-    public WriteStartException( MvccEntity entity, CollectionScope scope, final String message ) {
+    public WriteStartException( MvccEntity entity, ApplicationScope scope, final String message ) {
         super( entity, scope, message );
     }
 
 
-    public WriteStartException( MvccEntity entity, CollectionScope scope, final String message, final Throwable cause ) {
+    public WriteStartException( MvccEntity entity, ApplicationScope scope, final String message, final Throwable cause ) {
         super( entity, scope, message, cause );
     }
 
 
-    public WriteStartException( MvccEntity entity, CollectionScope scope, final Throwable cause ) {
+    public WriteStartException( MvccEntity entity, ApplicationScope scope, final Throwable cause ) {
         super( entity, scope, cause );
     }
 
 
-    public WriteStartException( MvccEntity entity, CollectionScope scope, final String message, final Throwable cause, final boolean enableSuppression,
+    public WriteStartException( MvccEntity entity, ApplicationScope scope, final String message, final Throwable cause, final boolean enableSuppression,
                                        final boolean writableStackTrace ) {
         super( entity, scope, message, cause, enableSuppression, writableStackTrace );
     }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c39be5da/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/WriteUniqueVerifyException.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/WriteUniqueVerifyException.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/WriteUniqueVerifyException.java
index a20e090..083eddb 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/WriteUniqueVerifyException.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/exception/WriteUniqueVerifyException.java
@@ -20,7 +20,7 @@ package org.apache.usergrid.persistence.collection.exception;
 
 import java.util.Map;
 
-import org.apache.usergrid.persistence.collection.CollectionScope;
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.collection.MvccEntity;
 import org.apache.usergrid.persistence.model.field.Field;
 
@@ -31,8 +31,8 @@ import org.apache.usergrid.persistence.model.field.Field;
 public class WriteUniqueVerifyException extends CollectionRuntimeException {
     private Map<String, Field> violations;
 
-    
-    public WriteUniqueVerifyException( MvccEntity entity, CollectionScope scope, Map<String, Field> violations ) {
+
+    public WriteUniqueVerifyException( MvccEntity entity, ApplicationScope scope, Map<String, Field> violations ) {
         super( entity, scope, "Error: one or more duplicate fields detected");
         this.violations = violations;
     }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c39be5da/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerFactoryImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerFactoryImpl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerFactoryImpl.java
index 409467c..5cc326b 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerFactoryImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerFactoryImpl.java
@@ -23,13 +23,12 @@ package org.apache.usergrid.persistence.collection.impl;
 
 import java.util.concurrent.ExecutionException;
 
-import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.EntityCollectionManager;
 import org.apache.usergrid.persistence.collection.EntityCollectionManagerFactory;
 import org.apache.usergrid.persistence.collection.cache.CachedEntityCollectionManager;
 import org.apache.usergrid.persistence.collection.cache.EntityCacheFig;
 import org.apache.usergrid.persistence.collection.guice.CollectionTaskExecutor;
-import org.apache.usergrid.persistence.collection.mvcc.MvccLogEntrySerializationStrategy;
+import org.apache.usergrid.persistence.collection.serialization.MvccLogEntrySerializationStrategy;
 import org.apache.usergrid.persistence.collection.mvcc.stage.delete.MarkCommit;
 import org.apache.usergrid.persistence.collection.mvcc.stage.delete.MarkStart;
 import org.apache.usergrid.persistence.collection.mvcc.stage.write.RollbackAction;
@@ -38,10 +37,10 @@ import org.apache.usergrid.persistence.collection.mvcc.stage.write.WriteOptimist
 import org.apache.usergrid.persistence.collection.mvcc.stage.write.WriteStart;
 import org.apache.usergrid.persistence.collection.mvcc.stage.write.WriteUniqueVerify;
 import org.apache.usergrid.persistence.collection.serialization.MvccEntitySerializationStrategy;
-import org.apache.usergrid.persistence.collection.serialization.SerializationFig;
 import org.apache.usergrid.persistence.collection.serialization.UniqueValueSerializationStrategy;
 import org.apache.usergrid.persistence.core.guice.ProxyImpl;
 import org.apache.usergrid.persistence.core.metrics.MetricsFactory;
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.core.task.TaskExecutor;
 
 import com.google.common.base.Preconditions;
@@ -50,7 +49,6 @@ import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
-import com.google.inject.assistedinject.Assisted;
 import com.netflix.astyanax.Keyspace;
 
 
@@ -78,10 +76,10 @@ public class EntityCollectionManagerFactoryImpl implements EntityCollectionManag
     private final EntityCacheFig entityCacheFig;
     private final MetricsFactory metricsFactory;
 
-    private LoadingCache<CollectionScope, EntityCollectionManager> ecmCache =
+    private LoadingCache<ApplicationScope, EntityCollectionManager> ecmCache =
         CacheBuilder.newBuilder().maximumSize( 1000 )
-                    .build( new CacheLoader<CollectionScope, EntityCollectionManager>() {
-                        public EntityCollectionManager load( CollectionScope scope ) {
+                    .build( new CacheLoader<ApplicationScope, EntityCollectionManager>() {
+                        public EntityCollectionManager load( ApplicationScope scope ) {
                                   //create the target EM that will perform logic
                             final EntityCollectionManager target = new EntityCollectionManagerImpl(
                                 writeStart, writeVerifyUnique,
@@ -129,10 +127,10 @@ public class EntityCollectionManagerFactoryImpl implements EntityCollectionManag
         this.metricsFactory = metricsFactory;
     }
     @Override
-    public EntityCollectionManager createCollectionManager(CollectionScope collectionScope) {
-        Preconditions.checkNotNull(collectionScope);
+    public EntityCollectionManager createCollectionManager(ApplicationScope applicationScope) {
+        Preconditions.checkNotNull(applicationScope);
         try{
-            return ecmCache.get(collectionScope);
+            return ecmCache.get(applicationScope);
         }catch (ExecutionException ee){
             throw new RuntimeException(ee);
         }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c39be5da/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
index 70b5a3a..1d73268 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
@@ -28,15 +28,13 @@ import java.util.UUID;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.EntityCollectionManager;
 import org.apache.usergrid.persistence.collection.EntitySet;
 import org.apache.usergrid.persistence.collection.FieldSet;
 import org.apache.usergrid.persistence.collection.MvccEntity;
 import org.apache.usergrid.persistence.collection.VersionSet;
 import org.apache.usergrid.persistence.collection.guice.CollectionTaskExecutor;
-import org.apache.usergrid.persistence.collection.mvcc.MvccLogEntrySerializationStrategy;
-import org.apache.usergrid.persistence.collection.mvcc.entity.MvccValidationUtils;
+import org.apache.usergrid.persistence.collection.serialization.MvccLogEntrySerializationStrategy;
 import org.apache.usergrid.persistence.collection.mvcc.stage.CollectionIoEvent;
 import org.apache.usergrid.persistence.collection.mvcc.stage.delete.MarkCommit;
 import org.apache.usergrid.persistence.collection.mvcc.stage.delete.MarkStart;
@@ -52,6 +50,7 @@ import org.apache.usergrid.persistence.collection.serialization.UniqueValueSet;
 import org.apache.usergrid.persistence.collection.serialization.impl.MutableFieldSet;
 import org.apache.usergrid.persistence.core.guice.ProxyImpl;
 import org.apache.usergrid.persistence.core.metrics.MetricsFactory;
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.core.task.Task;
 import org.apache.usergrid.persistence.core.task.TaskExecutor;
 import org.apache.usergrid.persistence.core.util.Health;
@@ -91,8 +90,6 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager {
 
     private static final Logger logger = LoggerFactory.getLogger( EntityCollectionManagerImpl.class );
 
-    private final CollectionScope collectionScope;
-
 
     //start stages
     private final WriteStart writeStart;
@@ -125,6 +122,8 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager {
     private final Meter loadMeter;
     private final Meter updateMeter;
 
+    private final ApplicationScope applicationScope;
+
 
     @Inject
     public EntityCollectionManagerImpl(
@@ -141,14 +140,14 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager {
         final Keyspace                             keyspace,
         final EntityVersionTaskFactory entityVersionTaskFactory,
         @CollectionTaskExecutor final TaskExecutor taskExecutor,
-        @Assisted final CollectionScope            collectionScope,
+        @Assisted final ApplicationScope applicationScope,
         final MetricsFactory metricsFactory
 
     ) {
         this.uniqueValueSerializationStrategy = uniqueValueSerializationStrategy;
         this.entitySerializationStrategy = entitySerializationStrategy;
 
-        MvccValidationUtils.validateCollectionScope( collectionScope );
+        ValidationUtils.validateApplicationScope( applicationScope );
 
         this.writeStart = writeStart;
         this.writeVerifyUnique = writeVerifyUnique;
@@ -165,7 +164,7 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager {
         this.entityVersionTaskFactory = entityVersionTaskFactory;
         this.taskExecutor = taskExecutor;
 
-        this.collectionScope = collectionScope;
+        this.applicationScope = applicationScope;
         this.mvccLogEntrySerializationStrategy = mvccLogEntrySerializationStrategy;
         this.writeTimer = metricsFactory.getTimer(EntityCollectionManagerImpl.class,"write.timer");
         this.writeMeter = metricsFactory.getMeter(EntityCollectionManagerImpl.class, "write.meter");
@@ -192,7 +191,7 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager {
 
 
         // create our observable and start the write
-        final CollectionIoEvent<Entity> writeData = new CollectionIoEvent<Entity>( collectionScope, entity );
+        final CollectionIoEvent<Entity> writeData = new CollectionIoEvent<Entity>( applicationScope, entity );
 
         Observable<CollectionIoEvent<MvccEntity>> observable = stageRunner( writeData, writeStart );
 
@@ -206,8 +205,8 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager {
             @Override
             public void call(final Entity entity) {
                 //TODO fire the created task first then the entityVersioncleanup
-                taskExecutor.submit( entityVersionTaskFactory.getCreatedTask( collectionScope, entity ));
-                taskExecutor.submit( entityVersionTaskFactory.getCleanupTask( collectionScope, entityId,
+                taskExecutor.submit( entityVersionTaskFactory.getCreatedTask( applicationScope, entity ));
+                taskExecutor.submit( entityVersionTaskFactory.getCleanupTask( applicationScope, entityId,
                     entity.getVersion(), false ));
                 //post-processing to come later. leave it empty for now.
             }
@@ -235,7 +234,7 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager {
         Preconditions.checkNotNull( entityId.getType(), "Entity type is required in this stage" );
 
         final Timer.Context timer = deleteTimer.time();
-        Observable<Id> o = Observable.just( new CollectionIoEvent<Id>( collectionScope, entityId ) )
+        Observable<Id> o = Observable.just( new CollectionIoEvent<Id>( applicationScope, entityId ) )
             .map(markStart)
             .doOnNext( markCommit )
             .map(new Func1<CollectionIoEvent<MvccEntity>, Id>() {
@@ -244,7 +243,7 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager {
                      public Id call(final CollectionIoEvent<MvccEntity> mvccEntityCollectionIoEvent) {
                          MvccEntity entity = mvccEntityCollectionIoEvent.getEvent();
                          Task<Void> task = entityVersionTaskFactory
-                             .getDeleteTask( collectionScope, entity.getId(), entity.getVersion() );
+                             .getDeleteTask( applicationScope, entity.getId(), entity.getVersion() );
                          taskExecutor.submit(task);
                          return entity.getId();
                      }
@@ -318,7 +317,7 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager {
             public void call( final Subscriber<? super EntitySet> subscriber ) {
                 try {
                     final EntitySet results =
-                            entitySerializationStrategy.load( collectionScope, entityIds, UUIDGenerator.newTimeUUID() );
+                            entitySerializationStrategy.load( applicationScope, entityIds, UUIDGenerator.newTimeUUID() );
 
                     subscriber.onNext( results );
                     subscriber.onCompleted();
@@ -344,13 +343,13 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager {
 
 
     @Override
-    public Observable<Id> getIdField( final Field field ) {
+    public Observable<Id> getIdField(final String type,  final Field field ) {
         final List<Field> fields = Collections.singletonList( field );
         return rx.Observable.from( fields ).map( new Func1<Field, Id>() {
             @Override
             public Id call( Field field ) {
                 try {
-                    final UniqueValueSet set = uniqueValueSerializationStrategy.load( collectionScope, fields );
+                    final UniqueValueSet set = uniqueValueSerializationStrategy.load( applicationScope, type, fields );
                     final UniqueValue value = set.getValue( field.getName() );
                     return value == null ? null : value.getEntityId();
                 }
@@ -369,7 +368,7 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager {
      * @return
      */
     @Override
-    public Observable<FieldSet> getEntitiesFromFields( final Collection<Field> fields ) {
+    public Observable<FieldSet> getEntitiesFromFields(final String type, final Collection<Field> fields ) {
         return rx.Observable.just(fields).map( new Func1<Collection<Field>, FieldSet>() {
             @Override
             public FieldSet call( Collection<Field> fields ) {
@@ -378,7 +377,7 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager {
                     final UUID startTime = UUIDGenerator.newTimeUUID();
 
                     //Get back set of unique values that correspond to collection of fields
-                    UniqueValueSet set = uniqueValueSerializationStrategy.load( collectionScope, fields );
+                    UniqueValueSet set = uniqueValueSerializationStrategy.load( applicationScope,type,  fields );
 
                     //Short circut if we don't have any uniqueValues from the given fields.
                     if(!set.iterator().hasNext()){
@@ -403,7 +402,7 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager {
                     }
 
                     //Load a entity for each entityId we retrieved.
-                    final EntitySet entitySet = entitySerializationStrategy.load(collectionScope, entityIds, startTime);
+                    final EntitySet entitySet = entitySerializationStrategy.load(applicationScope, entityIds, startTime);
 
                     //now loop through and ensure the entities are there.
                     final MutationBatch deleteBatch = keyspace.prepareMutationBatch();
@@ -415,7 +414,7 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager {
 
                         //bad unique value, delete this, it's inconsistent
                         if(entity == null || !entity.getEntity().isPresent()){
-                            final MutationBatch valueDelete = uniqueValueSerializationStrategy.delete(collectionScope, expectedUnique);
+                            final MutationBatch valueDelete = uniqueValueSerializationStrategy.delete(applicationScope, expectedUnique);
                             deleteBatch.mergeShallow(valueDelete);
                             continue;
                         }
@@ -482,7 +481,7 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager {
             public void call( final Subscriber<? super VersionSet> subscriber ) {
                 try {
                     final VersionSet logEntries = mvccLogEntrySerializationStrategy
-                            .load( collectionScope, entityIds, UUIDGenerator.newTimeUUID() );
+                            .load( applicationScope, entityIds, UUIDGenerator.newTimeUUID() );
 
                     subscriber.onNext( logEntries );
                     subscriber.onCompleted();

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c39be5da/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityDeletedTask.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityDeletedTask.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityDeletedTask.java
index 7620907..213cbb9 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityDeletedTask.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityDeletedTask.java
@@ -24,21 +24,17 @@ import com.netflix.astyanax.MutationBatch;
 import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.event.EntityDeleted;
 import org.apache.usergrid.persistence.collection.serialization.MvccEntitySerializationStrategy;
-import org.apache.usergrid.persistence.collection.mvcc.MvccLogEntrySerializationStrategy;
+import org.apache.usergrid.persistence.collection.serialization.MvccLogEntrySerializationStrategy;
 import org.apache.usergrid.persistence.core.task.Task;
 import org.apache.usergrid.persistence.model.entity.Id;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import rx.Observable;
-import rx.functions.Action1;
-import rx.functions.Func1;
 import rx.schedulers.Schedulers;
 
 import java.util.Set;
 import java.util.UUID;
 
-import org.apache.commons.lang.NotImplementedException;
-
 import org.apache.usergrid.persistence.core.guice.ProxyImpl;
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c39be5da/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCleanupTask.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCleanupTask.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCleanupTask.java
index 1a7b86b..f52eb25 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCleanupTask.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCleanupTask.java
@@ -35,7 +35,7 @@ import org.slf4j.LoggerFactory;
 import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.MvccLogEntry;
 import org.apache.usergrid.persistence.collection.event.EntityVersionDeleted;
-import org.apache.usergrid.persistence.collection.mvcc.MvccLogEntrySerializationStrategy;
+import org.apache.usergrid.persistence.collection.serialization.MvccLogEntrySerializationStrategy;
 import org.apache.usergrid.persistence.collection.serialization.SerializationFig;
 import org.apache.usergrid.persistence.collection.serialization.impl.LogEntryIterator;
 import org.apache.usergrid.persistence.core.rx.ObservableIterator;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c39be5da/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityVersionTaskFactory.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityVersionTaskFactory.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityVersionTaskFactory.java
index b41e668..e121b77 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityVersionTaskFactory.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityVersionTaskFactory.java
@@ -23,6 +23,7 @@ import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.impl.EntityDeletedTask;
 import org.apache.usergrid.persistence.collection.impl.EntityVersionCleanupTask;
 import org.apache.usergrid.persistence.collection.impl.EntityVersionCreatedTask;
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.model.entity.Entity;
 import org.apache.usergrid.persistence.model.entity.Id;
 
@@ -41,8 +42,8 @@ public interface EntityVersionTaskFactory {
      * @param includeVersion
      * @return
      */
-    public EntityVersionCleanupTask getCleanupTask( final CollectionScope scope, final Id entityId, final UUID version,
-                                                    final boolean includeVersion );
+    EntityVersionCleanupTask getCleanupTask( final ApplicationScope scope, final Id entityId, final UUID version,
+                                             final boolean includeVersion );
 
     /**
      * Get an entityVersionCreatedTask
@@ -50,7 +51,7 @@ public interface EntityVersionTaskFactory {
      * @param entity
      * @return
      */
-    public EntityVersionCreatedTask getCreatedTask( final CollectionScope scope, final Entity entity );
+    EntityVersionCreatedTask getCreatedTask( final ApplicationScope scope, final Entity entity );
 
     /**
      * Get an entity deleted task
@@ -59,7 +60,6 @@ public interface EntityVersionTaskFactory {
      * @param version
      * @return
      */
-    public EntityDeletedTask getDeleteTask( final CollectionScope collectionScope, final Id entityId,
-                                            final UUID version );
+    EntityDeletedTask getDeleteTask( final ApplicationScope collectionScope, final Id entityId, final UUID version );
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c39be5da/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/MvccLogEntrySerializationStrategy.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/MvccLogEntrySerializationStrategy.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/MvccLogEntrySerializationStrategy.java
deleted file mode 100644
index 4baef84..0000000
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/MvccLogEntrySerializationStrategy.java
+++ /dev/null
@@ -1,80 +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.
- */
-package org.apache.usergrid.persistence.collection.mvcc;
-
-
-import java.util.Collection;
-import java.util.List;
-import java.util.UUID;
-
-import org.apache.usergrid.persistence.collection.CollectionScope;
-import org.apache.usergrid.persistence.collection.MvccLogEntry;
-import org.apache.usergrid.persistence.collection.VersionSet;
-import org.apache.usergrid.persistence.core.migration.schema.Migration;
-import org.apache.usergrid.persistence.model.entity.Id;
-
-import com.netflix.astyanax.MutationBatch;
-
-
-/**
- * The interface that allows us to serialize a log entry to disk
- */
-public interface MvccLogEntrySerializationStrategy extends Migration {
-
-    /**
-     * Serialize the entity to the data store with the given collection context
-     *
-     * @param entry the entry to write
-     *
-     * @return The mutation batch with the mutation operations for this write.
-     */
-    public MutationBatch write( final CollectionScope context, MvccLogEntry entry );
-
-    /**
-     * Load and return the stage with the given id and a version that is <= the version provided
-     *
-     * @param context The context to persist the entity into
-     * @param entityIds The entity id to load
-     * @param version The max version to load.  This will return the first version <= the given version
-     *
-     * @return The deserialized version of the log entry
-     */
-    public VersionSet load( final CollectionScope context, final Collection<Id> entityIds, final UUID version );
-
-    /**
-     * Load a list, from highest to lowest of the stage with versions <= version up to maxSize elements
-     *
-     * @param context The context to load the entity from
-     * @param entityId The entity id to load
-     * @param version The max version to seek from
-     * @param maxSize The maximum size to return.  If you receive this size, there may be more versions to load.
-     *
-     * @return A list of entities up to max size ordered from max(UUID)=> min(UUID)
-     */
-    public List<MvccLogEntry> load( CollectionScope context, Id entityId, UUID version, int maxSize );
-
-    /**
-     * MarkCommit the stage from the context with the given entityId and version
-     *
-     * @param context The context that contains the entity
-     * @param entityId The entity id to delete
-     * @param version The version to delete
-     */
-    public MutationBatch delete( CollectionScope context, Id entityId, UUID version );
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c39be5da/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 d54f69a..20fa4be 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
@@ -21,6 +21,7 @@ package org.apache.usergrid.persistence.collection.mvcc.stage;
 import java.io.Serializable;
 
 import org.apache.usergrid.persistence.collection.CollectionScope;
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 
 
 /**
@@ -28,18 +29,18 @@ import org.apache.usergrid.persistence.collection.CollectionScope;
  */
 public class CollectionIoEvent<T> implements Serializable {
 
-    private CollectionScope context;
+    private ApplicationScope context;
 
     private T event;
 
 
-    public CollectionIoEvent( final CollectionScope context, final T event ) {
+    public CollectionIoEvent( final ApplicationScope context, final T event ) {
         this.context = context;
         this.event = event;
     }
 
 
-    public CollectionScope getEntityCollection() {
+    public ApplicationScope getEntityCollection() {
         return context;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c39be5da/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 5a0ada6..1c5a1eb 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
@@ -26,7 +26,7 @@ import org.slf4j.LoggerFactory;
 
 import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.serialization.MvccEntitySerializationStrategy;
-import org.apache.usergrid.persistence.collection.mvcc.MvccLogEntrySerializationStrategy;
+import org.apache.usergrid.persistence.collection.serialization.MvccLogEntrySerializationStrategy;
 import org.apache.usergrid.persistence.collection.MvccEntity;
 import org.apache.usergrid.persistence.collection.MvccLogEntry;
 import org.apache.usergrid.persistence.collection.mvcc.entity.MvccValidationUtils;
@@ -36,6 +36,7 @@ import org.apache.usergrid.persistence.collection.mvcc.stage.CollectionIoEvent;
 import org.apache.usergrid.persistence.collection.serialization.SerializationFig;
 import org.apache.usergrid.persistence.collection.serialization.UniqueValueSerializationStrategy;
 import org.apache.usergrid.persistence.core.guice.ProxyImpl;
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.model.entity.Id;
 
 import com.google.common.base.Preconditions;
@@ -92,7 +93,7 @@ public class MarkCommit implements Action1<CollectionIoEvent<MvccEntity>> {
         final UUID version = entity.getVersion();
 
 
-        final CollectionScope collectionScope = idIoEvent.getEntityCollection();
+        final ApplicationScope applicationScope = idIoEvent.getEntityCollection();
 
 
         LOG.debug("Inserting tombstone for entity {} at version {}", entityId, version );
@@ -100,12 +101,12 @@ public class MarkCommit implements Action1<CollectionIoEvent<MvccEntity>> {
         final MvccLogEntry startEntry =
                 new MvccLogEntryImpl( entityId, version, Stage.COMMITTED, MvccLogEntry.State.DELETED );
 
-        final MutationBatch entityStateBatch = logStrat.write( collectionScope, startEntry );
+        final MutationBatch entityStateBatch = logStrat.write( applicationScope, startEntry );
 
         //insert a "cleared" value into the versions.  Post processing should actually delete
 
         try {
-            final MutationBatch entityBatch = entityStrat.mark( collectionScope, entityId, version );
+            final MutationBatch entityBatch = entityStrat.mark( applicationScope, entityId, version );
             entityStateBatch.mergeShallow( entityBatch );
             entityStateBatch.execute();
         }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c39be5da/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/delete/MarkStart.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/delete/MarkStart.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/delete/MarkStart.java
index c80b076..04059c5 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/delete/MarkStart.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/delete/MarkStart.java
@@ -26,7 +26,7 @@ import org.slf4j.LoggerFactory;
 
 import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.exception.CollectionRuntimeException;
-import org.apache.usergrid.persistence.collection.mvcc.MvccLogEntrySerializationStrategy;
+import org.apache.usergrid.persistence.collection.serialization.MvccLogEntrySerializationStrategy;
 import org.apache.usergrid.persistence.collection.MvccEntity;
 import org.apache.usergrid.persistence.collection.MvccLogEntry;
 import org.apache.usergrid.persistence.collection.mvcc.entity.Stage;
@@ -34,6 +34,7 @@ import org.apache.usergrid.persistence.collection.mvcc.entity.impl.MvccEntityImp
 import org.apache.usergrid.persistence.collection.mvcc.entity.impl.MvccLogEntryImpl;
 import org.apache.usergrid.persistence.collection.mvcc.stage.CollectionIoEvent;
 import org.apache.usergrid.persistence.collection.service.UUIDService;
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.core.util.ValidationUtils;
 import org.apache.usergrid.persistence.model.entity.Entity;
 import org.apache.usergrid.persistence.model.entity.Id;
@@ -49,8 +50,8 @@ import rx.functions.Func1;
 
 
 /**
- * This is the first stage and should be invoked immediately when a write is started.  
- * It should persist the start of a new write in the data store for 
+ * This is the first stage and should be invoked immediately when a write is started.
+ * It should persist the start of a new write in the data store for
  * a checkpoint and recovery
  */
 @Singleton
@@ -86,12 +87,12 @@ public class MarkStart implements Func1<CollectionIoEvent<Id>, CollectionIoEvent
         final UUID version = uuidService.newTimeUUID();
 
 
-        final CollectionScope collectionScope = entityIoEvent.getEntityCollection();
+        final ApplicationScope applicationScope = entityIoEvent.getEntityCollection();
 
 
         final MvccLogEntry startEntry = new MvccLogEntryImpl( entityId, version, Stage.ACTIVE, MvccLogEntry.State.DELETED );
 
-        MutationBatch write = logStrategy.write( collectionScope, startEntry );
+        MutationBatch write = logStrategy.write( applicationScope, startEntry );
 
 
         try {
@@ -99,7 +100,7 @@ public class MarkStart implements Func1<CollectionIoEvent<Id>, CollectionIoEvent
         }
         catch ( ConnectionException e ) {
             LOG.error( "Failed to execute write asynchronously ", e );
-            throw new CollectionRuntimeException( null, collectionScope, 
+            throw new CollectionRuntimeException( null, applicationScope,
                     "Failed to execute write asynchronously ", e );
         }
 
@@ -109,6 +110,6 @@ public class MarkStart implements Func1<CollectionIoEvent<Id>, CollectionIoEvent
             entityId, version, MvccEntity.Status.COMPLETE, Optional.<Entity>absent() );
 
 
-        return new CollectionIoEvent<MvccEntity>( collectionScope, nextStage );
+        return new CollectionIoEvent<MvccEntity>( applicationScope, nextStage );
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c39be5da/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/RollbackAction.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/RollbackAction.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/RollbackAction.java
index e1becf8..0de1ab6 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/RollbackAction.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/RollbackAction.java
@@ -23,11 +23,12 @@ import org.slf4j.LoggerFactory;
 
 import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.exception.CollectionRuntimeException;
-import org.apache.usergrid.persistence.collection.mvcc.MvccLogEntrySerializationStrategy;
+import org.apache.usergrid.persistence.collection.serialization.MvccLogEntrySerializationStrategy;
 import org.apache.usergrid.persistence.collection.MvccEntity;
 import org.apache.usergrid.persistence.collection.serialization.UniqueValue;
 import org.apache.usergrid.persistence.collection.serialization.impl.UniqueValueImpl;
 import org.apache.usergrid.persistence.collection.serialization.UniqueValueSerializationStrategy;
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.model.entity.Entity;
 import org.apache.usergrid.persistence.model.field.Field;
 
@@ -70,7 +71,7 @@ public class RollbackAction implements Action1<Throwable> {
 
             CollectionRuntimeException cre = ( CollectionRuntimeException ) t;
             final MvccEntity mvccEntity = cre.getEntity();
-            final CollectionScope scope = cre.getCollectionScope();
+            final ApplicationScope scope = cre.getApplicationScope();
 
             // one batch to handle rollback
             MutationBatch rollbackMb = null;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c39be5da/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 65ba0b4..50321b6 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
@@ -26,7 +26,7 @@ import org.slf4j.LoggerFactory;
 import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.exception.WriteCommitException;
 import org.apache.usergrid.persistence.collection.serialization.MvccEntitySerializationStrategy;
-import org.apache.usergrid.persistence.collection.mvcc.MvccLogEntrySerializationStrategy;
+import org.apache.usergrid.persistence.collection.serialization.MvccLogEntrySerializationStrategy;
 import org.apache.usergrid.persistence.collection.MvccEntity;
 import org.apache.usergrid.persistence.collection.MvccLogEntry;
 import org.apache.usergrid.persistence.collection.mvcc.entity.MvccValidationUtils;
@@ -36,6 +36,7 @@ import org.apache.usergrid.persistence.collection.mvcc.stage.CollectionIoEvent;
 import org.apache.usergrid.persistence.collection.serialization.UniqueValue;
 import org.apache.usergrid.persistence.collection.serialization.impl.UniqueValueImpl;
 import org.apache.usergrid.persistence.collection.serialization.UniqueValueSerializationStrategy;
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.model.util.EntityUtils;
 import org.apache.usergrid.persistence.core.guice.ProxyImpl;
 import org.apache.usergrid.persistence.core.util.ValidationUtils;
@@ -92,7 +93,7 @@ public class WriteCommit implements Func1<CollectionIoEvent<MvccEntity>, Entity>
 
         final Id entityId = mvccEntity.getId();
         final UUID version = mvccEntity.getVersion();
-        final CollectionScope collectionScope = ioEvent.getEntityCollection();
+        final ApplicationScope applicationScope = ioEvent.getEntityCollection();
 
         //set the version into the entity
         EntityUtils.setVersion( mvccEntity.getEntity().get(), version );
@@ -102,10 +103,10 @@ public class WriteCommit implements Func1<CollectionIoEvent<MvccEntity>, Entity>
 
         final MvccLogEntry startEntry = new MvccLogEntryImpl( entityId, version, Stage.COMMITTED, MvccLogEntry.State.COMPLETE );
 
-        MutationBatch logMutation = logEntryStrat.write( collectionScope, startEntry );
+        MutationBatch logMutation = logEntryStrat.write( applicationScope, startEntry );
 
         // now get our actual insert into the entity data
-        MutationBatch entityMutation = entityStrat.write( collectionScope, mvccEntity );
+        MutationBatch entityMutation = entityStrat.write( applicationScope, mvccEntity );
 
         // merge the 2 into 1 mutation
         logMutation.mergeShallow( entityMutation );
@@ -116,7 +117,7 @@ public class WriteCommit implements Func1<CollectionIoEvent<MvccEntity>, Entity>
                 UniqueValue written  = new UniqueValueImpl( field,
                     entityId,version);
 
-                MutationBatch mb = uniqueValueStrat.write(collectionScope,  written );
+                MutationBatch mb = uniqueValueStrat.write(applicationScope,  written );
 
                 LOG.debug("Finalizing {} unqiue value {}", field.getName(), field.getValue().toString());
 
@@ -130,7 +131,7 @@ public class WriteCommit implements Func1<CollectionIoEvent<MvccEntity>, Entity>
         }
         catch ( ConnectionException e ) {
             LOG.error( "Failed to execute write asynchronously ", e );
-            throw new WriteCommitException( mvccEntity, collectionScope,
+            throw new WriteCommitException( mvccEntity, applicationScope,
                 "Failed to execute write asynchronously ", e );
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c39be5da/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteOptimisticVerify.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteOptimisticVerify.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteOptimisticVerify.java
index b031237..92656cc 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteOptimisticVerify.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteOptimisticVerify.java
@@ -25,12 +25,13 @@ import org.slf4j.LoggerFactory;
 
 import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.exception.WriteOptimisticVerifyException;
-import org.apache.usergrid.persistence.collection.mvcc.MvccLogEntrySerializationStrategy;
+import org.apache.usergrid.persistence.collection.serialization.MvccLogEntrySerializationStrategy;
 import org.apache.usergrid.persistence.collection.MvccEntity;
 import org.apache.usergrid.persistence.collection.MvccLogEntry;
 import org.apache.usergrid.persistence.collection.mvcc.entity.MvccValidationUtils;
 import org.apache.usergrid.persistence.collection.mvcc.entity.Stage;
 import org.apache.usergrid.persistence.collection.mvcc.stage.CollectionIoEvent;
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.model.entity.Entity;
 
 import com.google.inject.Inject;
@@ -69,14 +70,14 @@ public class WriteOptimisticVerify implements Action1<CollectionIoEvent<MvccEnti
         MvccEntity mvccEntity = ioevent.getEvent();
         final Entity entity = mvccEntity.getEntity().get();
 
-        CollectionScope collectionScope = ioevent.getEntityCollection();
+        ApplicationScope applicationScope = ioevent.getEntityCollection();
 
         if ( entity.getVersion() == null ) {
             return;
         }
 
 
-        List<MvccLogEntry> versions = logEntryStrat.load( collectionScope, entity.getId(), entity.getVersion(), 2 );
+        List<MvccLogEntry> versions = logEntryStrat.load( applicationScope, entity.getId(), entity.getVersion(), 2 );
 
         // Previous log entry must be committed, otherwise somebody is already writing
         if ( versions.size() > 1 && versions.get( 1 ).getStage().ordinal() < Stage.COMMITTED.ordinal() ) {
@@ -84,7 +85,7 @@ public class WriteOptimisticVerify implements Action1<CollectionIoEvent<MvccEnti
             log.debug( "Conflict writing entity id {} version {}", entity.getId().toString(),
                     entity.getVersion().toString() );
 
-            throw new WriteOptimisticVerifyException( mvccEntity, collectionScope,
+            throw new WriteOptimisticVerifyException( mvccEntity, applicationScope,
                     "Change conflict, not first writer" );
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c39be5da/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteStart.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteStart.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteStart.java
index 92dc69d..453a043 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteStart.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteStart.java
@@ -8,13 +8,14 @@ import org.slf4j.LoggerFactory;
 
 import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.exception.WriteStartException;
-import org.apache.usergrid.persistence.collection.mvcc.MvccLogEntrySerializationStrategy;
+import org.apache.usergrid.persistence.collection.serialization.MvccLogEntrySerializationStrategy;
 import org.apache.usergrid.persistence.collection.MvccEntity;
 import org.apache.usergrid.persistence.collection.MvccLogEntry;
 import org.apache.usergrid.persistence.collection.mvcc.entity.Stage;
 import org.apache.usergrid.persistence.collection.mvcc.entity.impl.MvccEntityImpl;
 import org.apache.usergrid.persistence.collection.mvcc.entity.impl.MvccLogEntryImpl;
 import org.apache.usergrid.persistence.collection.mvcc.stage.CollectionIoEvent;
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.model.entity.Entity;
 import org.apache.usergrid.persistence.model.entity.Id;
 import org.apache.usergrid.persistence.model.util.UUIDGenerator;
@@ -55,7 +56,7 @@ public class WriteStart implements Func1<CollectionIoEvent<Entity>, CollectionIo
     public CollectionIoEvent<MvccEntity> call( final CollectionIoEvent<Entity> ioEvent ) {
         {
             final Entity entity = ioEvent.getEvent();
-            final CollectionScope collectionScope = ioEvent.getEntityCollection();
+            final ApplicationScope applicationScope = ioEvent.getEntityCollection();
 
             final Id entityId = entity.getId();
 
@@ -65,7 +66,7 @@ public class WriteStart implements Func1<CollectionIoEvent<Entity>, CollectionIo
             final MvccLogEntry startEntry = new MvccLogEntryImpl( entityId, newVersion,
                     Stage.ACTIVE, MvccLogEntry.State.COMPLETE);
 
-            MutationBatch write = logStrategy.write( collectionScope, startEntry );
+            MutationBatch write = logStrategy.write( applicationScope, startEntry );
 
             final MvccEntityImpl nextStage = new MvccEntityImpl( entityId, newVersion, MvccEntity.Status.COMPLETE, entity );
             if(ioEvent.getEvent().hasVersion()) {
@@ -73,11 +74,11 @@ public class WriteStart implements Func1<CollectionIoEvent<Entity>, CollectionIo
                     write.execute();
                 } catch (ConnectionException e) {
                     LOG.error("Failed to execute write ", e);
-                    throw new WriteStartException(nextStage, collectionScope,
+                    throw new WriteStartException(nextStage, applicationScope,
                         "Failed to execute write ", e);
                 } catch (NullPointerException e) {
                     LOG.error("Failed to execute write ", e);
-                    throw new WriteStartException(nextStage, collectionScope,
+                    throw new WriteStartException(nextStage, applicationScope,
                         "Failed to execute write", e);
                 }
             }
@@ -85,7 +86,7 @@ public class WriteStart implements Func1<CollectionIoEvent<Entity>, CollectionIo
             //create the mvcc entity for the next stage
            //TODO: we need to create a complete or partial update here (or sooner)
 
-            return new CollectionIoEvent<MvccEntity>( collectionScope, nextStage );
+            return new CollectionIoEvent<>( applicationScope, nextStage );
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c39be5da/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 548127c..18c221c 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
@@ -28,13 +28,13 @@ import com.netflix.hystrix.HystrixCommand;
 import com.netflix.hystrix.HystrixCommandGroupKey;
 import com.netflix.hystrix.HystrixThreadPoolProperties;
 
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.model.util.EntityUtils;
 import org.apache.usergrid.persistence.core.astyanax.CassandraConfig;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.exception.WriteUniqueVerifyException;
 import org.apache.usergrid.persistence.collection.MvccEntity;
 import org.apache.usergrid.persistence.collection.mvcc.entity.MvccValidationUtils;
@@ -97,7 +97,7 @@ public class WriteUniqueVerify implements Action1<CollectionIoEvent<MvccEntity>>
 
         final Entity entity = mvccEntity.getEntity().get();
 
-        final CollectionScope scope = ioevent.getEntityCollection();
+        final ApplicationScope scope = ioevent.getEntityCollection();
 
         final MutationBatch batch = keyspace.prepareMutationBatch();
         //allocate our max size, worst case
@@ -137,9 +137,12 @@ public class WriteUniqueVerify implements Action1<CollectionIoEvent<MvccEntity>>
         }
 
         // use simple thread pool to verify fields in parallel
-        ConsistentReplayCommand cmd = new ConsistentReplayCommand(uniqueValueStrat,cassandraFig,scope, uniqueFields,entity);
+        ConsistentReplayCommand cmd = new ConsistentReplayCommand(uniqueValueStrat,cassandraFig,scope, entity.getId().getType(), uniqueFields,entity);
+
         Map<String,Field>  uniquenessViolations = cmd.execute();
-         cmd.getFailedExecutionException();
+
+        //do we want to do this?
+
         //We have violations, throw an exception
         if ( !uniquenessViolations.isEmpty() ) {
             throw new WriteUniqueVerifyException( mvccEntity, ioevent.getEntityCollection(), uniquenessViolations );
@@ -150,15 +153,19 @@ public class WriteUniqueVerify implements Action1<CollectionIoEvent<MvccEntity>>
 
         private final UniqueValueSerializationStrategy uniqueValueSerializationStrategy;
         private final CassandraConfig fig;
-        private final CollectionScope scope;
+        private final ApplicationScope scope;
+        private final String type;
         private final List<Field> uniqueFields;
         private final Entity entity;
 
-        public ConsistentReplayCommand(UniqueValueSerializationStrategy uniqueValueSerializationStrategy, CassandraConfig fig, CollectionScope scope, List<Field> uniqueFields, Entity entity){
+        public ConsistentReplayCommand( UniqueValueSerializationStrategy uniqueValueSerializationStrategy,
+                                        CassandraConfig fig, ApplicationScope scope, final String type, List<Field>
+                                            uniqueFields, Entity entity ){
             super(REPLAY_GROUP);
             this.uniqueValueSerializationStrategy = uniqueValueSerializationStrategy;
             this.fig = fig;
             this.scope = scope;
+            this.type = type;
             this.uniqueFields = uniqueFields;
             this.entity = entity;
         }
@@ -178,7 +185,7 @@ public class WriteUniqueVerify implements Action1<CollectionIoEvent<MvccEntity>>
             //now get the set of fields back
             final UniqueValueSet uniqueValues;
             try {
-                uniqueValues = uniqueValueSerializationStrategy.load( scope,consistencyLevel, uniqueFields );
+                uniqueValues = uniqueValueSerializationStrategy.load( scope, consistencyLevel, type,  uniqueFields );
             }
             catch ( ConnectionException e ) {
                 throw new RuntimeException( "Unable to read from cassandra", e );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c39be5da/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/MvccEntitySerializationStrategy.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/MvccEntitySerializationStrategy.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/MvccEntitySerializationStrategy.java
index 7028620..beb5621 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/MvccEntitySerializationStrategy.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/MvccEntitySerializationStrategy.java
@@ -28,6 +28,7 @@ import org.apache.usergrid.persistence.collection.EntitySet;
 import org.apache.usergrid.persistence.collection.MvccEntity;
 import org.apache.usergrid.persistence.core.migration.data.VersionedData;
 import org.apache.usergrid.persistence.core.migration.schema.Migration;
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.model.entity.Id;
 
 import com.google.common.base.Optional;
@@ -45,7 +46,7 @@ public interface MvccEntitySerializationStrategy extends Migration, VersionedDat
      * @param entity The entity to persist
      * @return The MutationBatch operations for this update
      */
-    public MutationBatch write(CollectionScope context, MvccEntity entity);
+    public MutationBatch write(ApplicationScope context, MvccEntity entity);
 
 
     /**
@@ -55,7 +56,7 @@ public interface MvccEntitySerializationStrategy extends Migration, VersionedDat
      * @param entityIds
      * @return
      */
-    public EntitySet load(CollectionScope scope, Collection<Id> entityIds, UUID maxVersion);
+    public EntitySet load(ApplicationScope scope, Collection<Id> entityIds, UUID maxVersion);
 
     /**
      * Load a list, from highest to lowest of the entity with versions <= version up to maxSize elements
@@ -69,7 +70,7 @@ public interface MvccEntitySerializationStrategy extends Migration, VersionedDat
      */
     @Deprecated
     //this has been made obsolete in the latest version, only use the load methods
-    public Iterator<MvccEntity> loadDescendingHistory( CollectionScope context, Id entityId, UUID version,
+    public Iterator<MvccEntity> loadDescendingHistory( ApplicationScope context, Id entityId, UUID version,
                                                        int fetchSize );
 
     /**
@@ -85,7 +86,7 @@ public interface MvccEntitySerializationStrategy extends Migration, VersionedDat
      */
     @Deprecated
     //this has been made obsolete in the latest version, only use the load methods
-    public Iterator<MvccEntity> loadAscendingHistory( CollectionScope context, Id entityId, UUID version,
+    public Iterator<MvccEntity> loadAscendingHistory( ApplicationScope context, Id entityId, UUID version,
                                                       int fetchSize );
 
 
@@ -96,7 +97,7 @@ public interface MvccEntitySerializationStrategy extends Migration, VersionedDat
      * @param entityId
      * @return The MvccEntity if it exists.  Null otherwise
      */
-    public Optional<MvccEntity> load(CollectionScope scope, Id entityId);
+    public Optional<MvccEntity> load(ApplicationScope scope, Id entityId);
 
 
     /**
@@ -104,7 +105,7 @@ public interface MvccEntitySerializationStrategy extends Migration, VersionedDat
      * can be used in a mark+sweep system.  The entity with the given version will exist in the context, but no data
      * will be stored
      */
-    public MutationBatch mark(CollectionScope context, Id entityId, UUID version);
+    public MutationBatch mark(ApplicationScope context, Id entityId, UUID version);
 
 
     /**
@@ -114,6 +115,6 @@ public interface MvccEntitySerializationStrategy extends Migration, VersionedDat
      * @param entityId The entity id to delete
      * @param version  The version to delete
      */
-    public MutationBatch delete(CollectionScope context, Id entityId, UUID version);
+    public MutationBatch delete(ApplicationScope context, Id entityId, UUID version);
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/c39be5da/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/MvccLogEntrySerializationStrategy.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/MvccLogEntrySerializationStrategy.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/MvccLogEntrySerializationStrategy.java
new file mode 100644
index 0000000..d029249
--- /dev/null
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/MvccLogEntrySerializationStrategy.java
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ */
+package org.apache.usergrid.persistence.collection.serialization;
+
+
+import java.util.Collection;
+import java.util.List;
+import java.util.UUID;
+
+import org.apache.usergrid.persistence.collection.MvccLogEntry;
+import org.apache.usergrid.persistence.collection.VersionSet;
+import org.apache.usergrid.persistence.core.migration.schema.Migration;
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
+import org.apache.usergrid.persistence.model.entity.Id;
+
+import com.netflix.astyanax.MutationBatch;
+
+
+/**
+ * The interface that allows us to serialize a log entry to disk
+ */
+public interface MvccLogEntrySerializationStrategy extends Migration {
+
+    /**
+     * Serialize the entity to the data store with the given collection context
+     *
+     * @param applicationScope The applicationscope of the entrye
+     * @param entry the entry to write
+     *
+     * @return The mutation batch with the mutation operations for this write.
+     */
+    MutationBatch write( final ApplicationScope applicationScope, MvccLogEntry entry );
+
+    /**
+     * Load and return the stage with the given id and a version that is <= the version provided
+     *
+     * @param applicationScope The applicationScope to persist the entity into
+     * @param entityIds The entity id to load
+     * @param version The max version to load.  This will return the first version <= the given version
+     *
+     * @return The deserialized version of the log entry
+     */
+    VersionSet load( final ApplicationScope applicationScope, final Collection<Id> entityIds, final UUID version );
+
+    /**
+     * Load a list, from highest to lowest of the stage with versions <= version up to maxSize elements
+     *
+     * @param applicationScope The applicationScope to load the entity from
+     * @param entityId The entity id to load
+     * @param version The max version to seek from
+     * @param maxSize The maximum size to return.  If you receive this size, there may be more versions to load.
+     *
+     * @return A list of entities up to max size ordered from max(UUID)=> min(UUID)
+     */
+    List<MvccLogEntry> load( ApplicationScope applicationScope, Id entityId, UUID version, int maxSize );
+
+    /**
+     * MarkCommit the stage from the applicationScope with the given entityId and version
+     *
+     * @param applicationScope The applicationScope that contains the entity
+     * @param entityId The entity id to delete
+     * @param version The version to delete
+     */
+    MutationBatch delete( ApplicationScope applicationScope, Id entityId, UUID version );
+}