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 2014/10/28 00:04:42 UTC

[3/7] git commit: Finished low level serialization refactor

Finished low level serialization refactor


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

Branch: refs/heads/key-row-sharding
Commit: 5a56dd450b509d07abd9e363736a762093f864af
Parents: 2df4770
Author: Todd Nine <tn...@apigee.com>
Authored: Fri Oct 24 09:46:53 2014 -0600
Committer: Todd Nine <tn...@apigee.com>
Committed: Fri Oct 24 10:26:58 2014 -0600

----------------------------------------------------------------------
 .../impl/CollectionPrefixedKey.java             | 100 +++++++++++++++++++
 .../impl/CollectionScopedRowKeySerializer.java  |  25 +++--
 .../MvccEntitySerializationStrategyImpl.java    |  86 ++++++++++++----
 .../MvccLogEntrySerializationStrategyImpl.java  |  64 +++++++++---
 .../UniqueValueSerializationStrategyImpl.java   |  29 ++++--
 .../impl/ScopedRowKeySerializerTest.java        |  18 ++--
 .../core/astyanax/BucketScopedRowKey.java       |  20 +++-
 .../core/astyanax/MultiTennantColumnFamily.java |   8 +-
 ...rganizationScopedBucketRowKeySerializer.java |  93 +++++++++++++++++
 .../OrganizationScopedRowKeySerializer.java     |  12 ++-
 .../persistence/core/astyanax/ScopedRowKey.java |  13 +--
 .../impl/EdgeMetadataSerializationImpl.java     |  55 +++++-----
 .../impl/NodeSerializationImpl.java             |  28 +++---
 .../impl/shard/EdgeColumnFamilies.java          |  11 +-
 .../NodeShardCounterSerializationImpl.java      |   6 +-
 .../impl/shard/impl/EdgeSearcher.java           |   8 +-
 .../shard/impl/EdgeShardSerializationImpl.java  |  10 +-
 .../impl/ShardedEdgeSerializationImpl.java      |  76 +++++++-------
 .../impl/shard/impl/ShardsColumnIterator.java   |   8 +-
 .../shard/impl/SizebasedEdgeColumnFamilies.java |  21 ++--
 .../map/impl/MapSerializationImpl.java          |  81 ++++++++++-----
 21 files changed, 559 insertions(+), 213 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5a56dd45/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/CollectionPrefixedKey.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/CollectionPrefixedKey.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/CollectionPrefixedKey.java
new file mode 100644
index 0000000..529e06c
--- /dev/null
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/CollectionPrefixedKey.java
@@ -0,0 +1,100 @@
+package org.apache.usergrid.persistence.collection.serialization.impl;/*
+ * 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.
+ */
+
+
+import org.apache.usergrid.persistence.model.entity.Id;
+
+
+/**
+ * Wrapper object to create collections in prefixes
+ */
+public class CollectionPrefixedKey<K> {
+
+    private final String collectionName;
+    private final Id owner;
+    private final K subKey;
+
+
+    public CollectionPrefixedKey( final String collectionName, final Id owner, final K subKey ) {
+        this.collectionName = collectionName;
+        this.owner = owner;
+        this.subKey = subKey;
+    }
+
+
+    /**
+     * Get the name of the
+     * @return
+     */
+    public String getCollectionName() {
+        return collectionName;
+    }
+
+
+    /**
+     * Get the owner of the collection
+     * @return
+     */
+    public Id getOwner() {
+        return owner;
+    }
+
+
+    /**
+     * Get the object to be used in the key
+     * @return
+     */
+    public K getSubKey() {
+        return subKey;
+    }
+
+
+    @Override
+    public boolean equals( final Object o ) {
+        if ( this == o ) {
+            return true;
+        }
+        if ( !( o instanceof CollectionPrefixedKey ) ) {
+            return false;
+        }
+
+        final CollectionPrefixedKey that = ( CollectionPrefixedKey ) o;
+
+        if ( !collectionName.equals( that.collectionName ) ) {
+            return false;
+        }
+        if ( !subKey.equals( that.subKey ) ) {
+            return false;
+        }
+        if ( !owner.equals( that.owner ) ) {
+            return false;
+        }
+
+        return true;
+    }
+
+
+    @Override
+    public int hashCode() {
+        int result = collectionName.hashCode();
+        result = 31 * result + owner.hashCode();
+        result = 31 * result + subKey.hashCode();
+        return result;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5a56dd45/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/CollectionScopedRowKeySerializer.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/CollectionScopedRowKeySerializer.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/CollectionScopedRowKeySerializer.java
index 556a662..d560145 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/CollectionScopedRowKeySerializer.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/CollectionScopedRowKeySerializer.java
@@ -20,8 +20,6 @@ package org.apache.usergrid.persistence.collection.serialization.impl;
 
 import java.nio.ByteBuffer;
 
-import org.apache.usergrid.persistence.collection.CollectionScope;
-import org.apache.usergrid.persistence.collection.impl.CollectionScopeImpl;
 import org.apache.usergrid.persistence.core.astyanax.CompositeFieldSerializer;
 import org.apache.usergrid.persistence.core.astyanax.IdRowCompositeSerializer;
 import org.apache.usergrid.persistence.core.astyanax.ScopedRowKey;
@@ -37,7 +35,7 @@ import com.netflix.astyanax.serializers.AbstractSerializer;
  * Serializer for serializing CollectionScope + any type into row keys
  */
 public class CollectionScopedRowKeySerializer<K> 
-    extends AbstractSerializer<ScopedRowKey<CollectionScope, K>> {
+    extends AbstractSerializer<ScopedRowKey<CollectionPrefixedKey<K>>> {
 
     private static final IdRowCompositeSerializer ID_SER = IdRowCompositeSerializer.get();
 
@@ -52,21 +50,23 @@ public class CollectionScopedRowKeySerializer<K>
     }
 
     @Override
-    public ByteBuffer toByteBuffer( final ScopedRowKey<CollectionScope, K> scopedRowKey ) {
+    public ByteBuffer toByteBuffer( final ScopedRowKey<CollectionPrefixedKey<K>> scopedRowKey ) {
 
         final CompositeBuilder builder = Composites.newCompositeBuilder();
 
         //add the organization's id
-        ID_SER.toComposite( builder, scopedRowKey.getScope().getApplication() );
+        ID_SER.toComposite( builder, scopedRowKey.getScope() );
+
+        final CollectionPrefixedKey<K> key = scopedRowKey.getKey();
 
         //add the scope's owner id to the composite
-        ID_SER.toComposite( builder, scopedRowKey.getScope().getOwner() );
+        ID_SER.toComposite( builder, key.getOwner() );
 
         //add the scope's name
-        builder.addString( scopedRowKey.getScope().getName() );
+        builder.addString( key.getCollectionName() );
 
         //add the key type
-        keySerializer.toComposite( builder, scopedRowKey.getKey() );
+        keySerializer.toComposite( builder, key.getSubKey() );
 
         //addOtherComponents( builder, scopedRowKey );
 
@@ -74,7 +74,7 @@ public class CollectionScopedRowKeySerializer<K>
     }
 
     @Override
-    public ScopedRowKey<CollectionScope, K> fromByteBuffer( final ByteBuffer byteBuffer ) {
+    public ScopedRowKey<CollectionPrefixedKey<K>> fromByteBuffer( final ByteBuffer byteBuffer ) {
         final CompositeParser parser = Composites.newCompositeParser( byteBuffer );
 
         //read back the id
@@ -83,8 +83,11 @@ public class CollectionScopedRowKeySerializer<K>
         final String scopeName = parser.readString();
         final K value = keySerializer.fromComposite( parser );
 
-        return new ScopedRowKey<CollectionScope, K>( 
-                new CollectionScopeImpl( orgId, scopeId, scopeName ), value ); 
+
+        final CollectionPrefixedKey<K> collectionPrefixedKey = new CollectionPrefixedKey<>( scopeName,  scopeId, value );
+
+
+        return new ScopedRowKey<>( orgId, collectionPrefixedKey );
     }
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5a56dd45/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImpl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImpl.java
index 31c26a9..dfa41ea 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImpl.java
@@ -36,9 +36,9 @@ import org.apache.cassandra.db.marshal.UUIDType;
 
 import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.EntitySet;
+import org.apache.usergrid.persistence.collection.MvccEntity;
 import org.apache.usergrid.persistence.collection.exception.CollectionRuntimeException;
 import org.apache.usergrid.persistence.collection.mvcc.MvccEntitySerializationStrategy;
-import org.apache.usergrid.persistence.collection.MvccEntity;
 import org.apache.usergrid.persistence.collection.mvcc.entity.impl.MvccEntityImpl;
 import org.apache.usergrid.persistence.collection.serialization.EntityRepair;
 import org.apache.usergrid.persistence.collection.serialization.SerializationFig;
@@ -96,9 +96,8 @@ public class MvccEntitySerializationStrategyImpl implements MvccEntitySerializat
     private static final CollectionScopedRowKeySerializer<Id> ROW_KEY_SER =
             new CollectionScopedRowKeySerializer<Id>( ID_SER );
 
-    private static final MultiTennantColumnFamily<CollectionScope, Id, UUID> CF_ENTITY_DATA =
-            new MultiTennantColumnFamily<CollectionScope, Id, UUID>( "Entity_Version_Data", ROW_KEY_SER,
-                    UUIDSerializer.get() );
+    private static final MultiTennantColumnFamily<ScopedRowKey<CollectionPrefixedKey<Id>>, UUID> CF_ENTITY_DATA =
+            new MultiTennantColumnFamily<>( "Entity_Version_Data", ROW_KEY_SER, UUIDSerializer.get() );
 
 
     protected final Keyspace keyspace;
@@ -141,7 +140,6 @@ public class MvccEntitySerializationStrategyImpl implements MvccEntitySerializat
     }
 
 
-
     @Override
     public EntitySet load( final CollectionScope collectionScope, final Collection<Id> entityIds,
                            final UUID maxVersion ) {
@@ -154,37 +152,49 @@ public class MvccEntitySerializationStrategyImpl implements MvccEntitySerializat
 
 
         //didn't put the max in the error message, I don't want to take the string construction hit every time
-        Preconditions.checkArgument( entityIds.size() <=  serializationFig.getMaxLoadSize(), "requested size cannot be over configured maximum");
+        Preconditions.checkArgument( entityIds.size() <= serializationFig.getMaxLoadSize(),
+                "requested size cannot be over configured maximum" );
+
 
+        final Id applicationId = collectionScope.getApplication();
+        final Id ownerId = collectionScope.getOwner();
+        final String collectionName = collectionScope.getName();
 
 
-        final List<ScopedRowKey<CollectionScope, Id>> rowKeys = new ArrayList<>( entityIds.size() );
+        final List<ScopedRowKey<CollectionPrefixedKey<Id>>> rowKeys = new ArrayList<>( entityIds.size() );
 
 
         for ( final Id entityId : entityIds ) {
-            rowKeys.add( ScopedRowKey.fromKey( collectionScope, entityId ) );
-        }
+            final CollectionPrefixedKey<Id> collectionPrefixedKey =
+                    new CollectionPrefixedKey<>( collectionName, ownerId, entityId );
+
+
+            final ScopedRowKey<CollectionPrefixedKey<Id>> rowKey =
+                    ScopedRowKey.fromKey( applicationId, collectionPrefixedKey );
 
 
-        final Iterator<Row<ScopedRowKey<CollectionScope, Id>, UUID>> latestEntityColumns;
+            rowKeys.add( rowKey );
+        }
+
 
+        final Iterator<Row<ScopedRowKey<CollectionPrefixedKey<Id>>, UUID>> latestEntityColumns;
 
 
         try {
             latestEntityColumns = keyspace.prepareQuery( CF_ENTITY_DATA ).getKeySlice( rowKeys )
                                           .withColumnRange( maxVersion, null, false, 1 ).execute().getResult()
                                           .iterator();
-        } catch ( ConnectionException e ) {
+        }
+        catch ( ConnectionException e ) {
             throw new CollectionRuntimeException( null, collectionScope, "An error occurred connecting to cassandra",
                     e );
         }
 
 
-
         final EntitySetImpl entitySetResults = new EntitySetImpl( entityIds.size() );
 
         while ( latestEntityColumns.hasNext() ) {
-            final Row<ScopedRowKey<CollectionScope, Id>, UUID> row = latestEntityColumns.next();
+            final Row<ScopedRowKey<CollectionPrefixedKey<Id>>, UUID> row = latestEntityColumns.next();
 
             final ColumnList<UUID> columns = row.getColumns();
 
@@ -192,7 +202,7 @@ public class MvccEntitySerializationStrategyImpl implements MvccEntitySerializat
                 continue;
             }
 
-            final Id entityId = row.getKey().getKey();
+            final Id entityId = row.getKey().getKey().getSubKey();
 
             final Column<UUID> column = columns.getColumnByIndex( 0 );
 
@@ -202,7 +212,6 @@ public class MvccEntitySerializationStrategyImpl implements MvccEntitySerializat
             final MvccEntity maybeRepaired = repair.maybeRepair( collectionScope, parsedEntity );
 
             entitySetResults.addEntity( maybeRepaired );
-
         }
 
         return entitySetResults;
@@ -219,8 +228,20 @@ public class MvccEntitySerializationStrategyImpl implements MvccEntitySerializat
         Preconditions.checkArgument( fetchSize > 0, "max Size must be greater than 0" );
 
 
-        RowQuery<ScopedRowKey<CollectionScope, Id>, UUID> query =
-                keyspace.prepareQuery( CF_ENTITY_DATA ).getKey( ScopedRowKey.fromKey( collectionScope, entityId ) )
+        final Id applicationId = collectionScope.getApplication();
+        final Id ownerId = collectionScope.getOwner();
+        final String collectionName = collectionScope.getName();
+
+        final CollectionPrefixedKey<Id> collectionPrefixedKey =
+                new CollectionPrefixedKey<>( collectionName, ownerId, entityId );
+
+
+        final ScopedRowKey<CollectionPrefixedKey<Id>> rowKey =
+                ScopedRowKey.fromKey( applicationId, collectionPrefixedKey );
+
+
+        RowQuery<ScopedRowKey<CollectionPrefixedKey<Id>>, UUID> query =
+                keyspace.prepareQuery( CF_ENTITY_DATA ).getKey( rowKey )
                         .withColumnRange( version, null, false, fetchSize );
 
         return new ColumnNameIterator( query, new MvccColumnParser( entityId ), false );
@@ -236,8 +257,21 @@ public class MvccEntitySerializationStrategyImpl implements MvccEntitySerializat
         Preconditions.checkNotNull( version, "version is required" );
         Preconditions.checkArgument( fetchSize > 0, "max Size must be greater than 0" );
 
-        RowQuery<ScopedRowKey<CollectionScope, Id>, UUID> query =
-                keyspace.prepareQuery( CF_ENTITY_DATA ).getKey( ScopedRowKey.fromKey( collectionScope, entityId ) )
+
+        final Id applicationId = collectionScope.getApplication();
+        final Id ownerId = collectionScope.getOwner();
+        final String collectionName = collectionScope.getName();
+
+        final CollectionPrefixedKey<Id> collectionPrefixedKey =
+                new CollectionPrefixedKey<>( collectionName, ownerId, entityId );
+
+
+        final ScopedRowKey<CollectionPrefixedKey<Id>> rowKey =
+                ScopedRowKey.fromKey( applicationId, collectionPrefixedKey );
+
+
+        RowQuery<ScopedRowKey<CollectionPrefixedKey<Id>>, UUID> query =
+                keyspace.prepareQuery( CF_ENTITY_DATA ).getKey( rowKey )
                         .withColumnRange( null, version, true, fetchSize );
 
         return new ColumnNameIterator( query, new MvccColumnParser( entityId ), false );
@@ -299,7 +333,19 @@ public class MvccEntitySerializationStrategyImpl implements MvccEntitySerializat
     private MutationBatch doWrite( final CollectionScope collectionScope, final Id entityId, final RowOp op ) {
         final MutationBatch batch = keyspace.prepareMutationBatch();
 
-        op.doOp( batch.withRow( CF_ENTITY_DATA, ScopedRowKey.fromKey( collectionScope, entityId ) ) );
+        final Id applicationId = collectionScope.getApplication();
+        final Id ownerId = collectionScope.getOwner();
+        final String collectionName = collectionScope.getName();
+
+        final CollectionPrefixedKey<Id> collectionPrefixedKey =
+                new CollectionPrefixedKey<>( collectionName, ownerId, entityId );
+
+
+        final ScopedRowKey<CollectionPrefixedKey<Id>> rowKey =
+                ScopedRowKey.fromKey( applicationId, collectionPrefixedKey );
+
+
+        op.doOp( batch.withRow( CF_ENTITY_DATA, rowKey ) );
 
         return batch;
     }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5a56dd45/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyImpl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyImpl.java
index e4aeb0b..8577fbf 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyImpl.java
@@ -82,8 +82,8 @@ public class MvccLogEntrySerializationStrategyImpl implements MvccLogEntrySerial
     private static final CollectionScopedRowKeySerializer<Id> ROW_KEY_SER =
             new CollectionScopedRowKeySerializer<Id>( ID_SER );
 
-    private static final MultiTennantColumnFamily<CollectionScope, Id, UUID> CF_ENTITY_LOG =
-            new MultiTennantColumnFamily<CollectionScope, Id, UUID>( "Entity_Log", ROW_KEY_SER, UUIDSerializer.get() );
+    private static final MultiTennantColumnFamily<ScopedRowKey<CollectionPrefixedKey<Id>>, UUID> CF_ENTITY_LOG =
+            new MultiTennantColumnFamily<>( "Entity_Log", ROW_KEY_SER, UUIDSerializer.get() );
 
 
     protected final Keyspace keyspace;
@@ -139,15 +139,28 @@ public class MvccLogEntrySerializationStrategyImpl implements MvccLogEntrySerial
                 "requested size cannot be over configured maximum" );
 
 
-        final List<ScopedRowKey<CollectionScope, Id>> rowKeys = new ArrayList<>( entityIds.size() );
+        final Id applicationId = collectionScope.getApplication();
+        final Id ownerId = collectionScope.getOwner();
+        final String collectionName = collectionScope.getName();
+
+
+        final List<ScopedRowKey<CollectionPrefixedKey<Id>>> rowKeys = new ArrayList<>( entityIds.size() );
 
 
         for ( final Id entityId : entityIds ) {
-            rowKeys.add( ScopedRowKey.fromKey( collectionScope, entityId ) );
+            final CollectionPrefixedKey<Id> collectionPrefixedKey =
+                    new CollectionPrefixedKey<>( collectionName, ownerId, entityId );
+
+
+            final ScopedRowKey<CollectionPrefixedKey<Id>> rowKey =
+                    ScopedRowKey.fromKey( applicationId, collectionPrefixedKey );
+
+
+            rowKeys.add( rowKey );
         }
 
 
-        final Iterator<Row<ScopedRowKey<CollectionScope, Id>, UUID>> latestEntityColumns;
+        final Iterator<Row<ScopedRowKey<CollectionPrefixedKey<Id>>, UUID>> latestEntityColumns;
 
 
         try {
@@ -164,7 +177,7 @@ public class MvccLogEntrySerializationStrategyImpl implements MvccLogEntrySerial
         final VersionSetImpl versionResults = new VersionSetImpl( entityIds.size() );
 
         while ( latestEntityColumns.hasNext() ) {
-            final Row<ScopedRowKey<CollectionScope, Id>, UUID> row = latestEntityColumns.next();
+            final Row<ScopedRowKey<CollectionPrefixedKey<Id>>, UUID> row = latestEntityColumns.next();
 
             final ColumnList<UUID> columns = row.getColumns();
 
@@ -173,7 +186,7 @@ public class MvccLogEntrySerializationStrategyImpl implements MvccLogEntrySerial
             }
 
 
-            final Id entityId = row.getKey().getKey();
+            final Id entityId = row.getKey().getKey().getSubKey();
 
             final Column<UUID> column = columns.getColumnByIndex( 0 );
 
@@ -202,9 +215,23 @@ public class MvccLogEntrySerializationStrategyImpl implements MvccLogEntrySerial
         Preconditions.checkArgument( maxSize > 0, "max Size must be greater than 0" );
 
 
-        ColumnList<UUID> columns = null;
+        ColumnList<UUID> columns;
         try {
-            columns = keyspace.prepareQuery( CF_ENTITY_LOG ).getKey( ScopedRowKey.fromKey( collectionScope, entityId ) )
+
+            final Id applicationId = collectionScope.getApplication();
+            final Id ownerId = collectionScope.getOwner();
+            final String collectionName = collectionScope.getName();
+
+
+            final CollectionPrefixedKey<Id> collectionPrefixedKey =
+                    new CollectionPrefixedKey<>( collectionName, ownerId, entityId );
+
+
+            final ScopedRowKey<CollectionPrefixedKey<Id>> rowKey =
+                    ScopedRowKey.fromKey( applicationId, collectionPrefixedKey );
+
+
+            columns = keyspace.prepareQuery( CF_ENTITY_LOG ).getKey( rowKey )
                               .withColumnRange( version, null, false, maxSize ).execute().getResult();
         }
         catch ( ConnectionException e ) {
@@ -270,9 +297,9 @@ public class MvccLogEntrySerializationStrategyImpl implements MvccLogEntrySerial
     /**
      * Do the column update or delete for the given column and row key
      *
-     * @param context We need to use this when getting the keyspace
+     * @param collectionScope We need to use this when getting the keyspace
      */
-    private MutationBatch doWrite( CollectionScope context, Id entityId, UUID version, RowOp op ) {
+    private MutationBatch doWrite( CollectionScope collectionScope, Id entityId, UUID version, RowOp op ) {
 
         final MutationBatch batch = keyspace.prepareMutationBatch();
 
@@ -280,7 +307,20 @@ public class MvccLogEntrySerializationStrategyImpl implements MvccLogEntrySerial
 
         LOG.debug( "Writing version with timestamp '{}'", timestamp );
 
-        op.doOp( batch.withRow( CF_ENTITY_LOG, ScopedRowKey.fromKey( context, entityId ) ) );
+        final Id applicationId = collectionScope.getApplication();
+        final Id ownerId = collectionScope.getOwner();
+        final String collectionName = collectionScope.getName();
+
+
+        final CollectionPrefixedKey<Id> collectionPrefixedKey =
+                new CollectionPrefixedKey<>( collectionName, ownerId, entityId );
+
+
+        final ScopedRowKey<CollectionPrefixedKey<Id>> rowKey =
+                ScopedRowKey.fromKey( applicationId, collectionPrefixedKey );
+
+
+        op.doOp( batch.withRow( CF_ENTITY_LOG, rowKey ) );
 
         return batch;
     }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5a56dd45/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyImpl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyImpl.java
index a3e4adc..954cd1c 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyImpl.java
@@ -50,7 +50,6 @@ import com.netflix.astyanax.Keyspace;
 import com.netflix.astyanax.MutationBatch;
 import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
 import com.netflix.astyanax.model.Column;
-import com.netflix.astyanax.model.ColumnList;
 import com.netflix.astyanax.model.Row;
 import com.netflix.astyanax.util.RangeBuilder;
 
@@ -68,8 +67,8 @@ public class UniqueValueSerializationStrategyImpl implements UniqueValueSerializ
 
     private static final EntityVersionSerializer ENTITY_VERSION_SER = new EntityVersionSerializer();
 
-    private static final MultiTennantColumnFamily<CollectionScope, Field, EntityVersion> CF_UNIQUE_VALUES =
-            new MultiTennantColumnFamily<CollectionScope, Field, EntityVersion>( "Unique_Values", ROW_KEY_SER,
+    private static final MultiTennantColumnFamily<ScopedRowKey<CollectionPrefixedKey<Field>>, EntityVersion> CF_UNIQUE_VALUES =
+            new MultiTennantColumnFamily<>( "Unique_Values", ROW_KEY_SER,
                     ENTITY_VERSION_SER );
 
     protected final Keyspace keyspace;
@@ -164,7 +163,10 @@ public class UniqueValueSerializationStrategyImpl implements UniqueValueSerializ
      */
     private MutationBatch doWrite( CollectionScope context, Field field, RowOp op ) {
         final MutationBatch batch = keyspace.prepareMutationBatch();
-        op.doOp( batch.withRow( CF_UNIQUE_VALUES, ScopedRowKey.fromKey( context, field ) ) );
+        final CollectionPrefixedKey<Field> collectionPrefixedKey = new CollectionPrefixedKey<>( context.getName(), context.getOwner(), field );
+
+
+        op.doOp( batch.withRow( CF_UNIQUE_VALUES, ScopedRowKey.fromKey( context.getApplication(), collectionPrefixedKey ) ) );
         return batch;
     }
 
@@ -176,17 +178,26 @@ public class UniqueValueSerializationStrategyImpl implements UniqueValueSerializ
         Preconditions.checkNotNull( fields, "fields are required" );
         Preconditions.checkArgument( fields.size() > 0, "More than 1 field msut be specified" );
 
-        final List<ScopedRowKey<CollectionScope, Field>> keys = new ArrayList<>( fields.size() );
+
+        final List<ScopedRowKey<CollectionPrefixedKey<Field>>> keys = new ArrayList<>( fields.size() );
+
+        final Id applicationId = colScope.getApplication();
+        final Id ownerId = colScope.getOwner();
+        final String collectionName = colScope.getName();
 
         for ( Field field : fields ) {
-            final ScopedRowKey<CollectionScope, Field> rowKey = ScopedRowKey.fromKey( colScope, field );
+
+            final CollectionPrefixedKey<Field> collectionPrefixedKey = new CollectionPrefixedKey<>( collectionName, ownerId, field );
+
+
+            final ScopedRowKey<CollectionPrefixedKey<Field>> rowKey = ScopedRowKey.fromKey(applicationId, collectionPrefixedKey );
 
             keys.add( rowKey );
         }
 
         final UniqueValueSetImpl uniqueValueSet = new UniqueValueSetImpl( fields.size() );
 
-        Iterator<Row<ScopedRowKey<CollectionScope, Field>, EntityVersion>> results =
+        Iterator<Row<ScopedRowKey<CollectionPrefixedKey<Field>>, EntityVersion>> results =
                 keyspace.prepareQuery( CF_UNIQUE_VALUES ).getKeySlice( keys )
                         .withColumnRange( new RangeBuilder().setLimit( 1 ).build() ).execute().getResult().iterator();
 
@@ -195,10 +206,10 @@ public class UniqueValueSerializationStrategyImpl implements UniqueValueSerializ
 
         {
 
-            final Row<ScopedRowKey<CollectionScope, Field>, EntityVersion> unique = results.next();
+            final Row<ScopedRowKey<CollectionPrefixedKey<Field>>, EntityVersion> unique = results.next();
 
 
-            final Field field = unique.getKey().getKey();
+            final Field field = unique.getKey().getKey().getSubKey();
 
             final Iterator<Column<EntityVersion>> columnList = unique.getColumns().iterator();
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5a56dd45/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/ScopedRowKeySerializerTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/ScopedRowKeySerializerTest.java b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/ScopedRowKeySerializerTest.java
index ef2df0e..a09b623 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/ScopedRowKeySerializerTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/ScopedRowKeySerializerTest.java
@@ -24,8 +24,6 @@ import java.nio.ByteBuffer;
 
 import org.junit.Test;
 
-import org.apache.usergrid.persistence.collection.CollectionScope;
-import org.apache.usergrid.persistence.collection.impl.CollectionScopeImpl;
 import org.apache.usergrid.persistence.core.astyanax.IdRowCompositeSerializer;
 import org.apache.usergrid.persistence.core.astyanax.ScopedRowKey;
 import org.apache.usergrid.persistence.model.entity.Id;
@@ -43,20 +41,22 @@ public class ScopedRowKeySerializerTest {
         final Id testId = new SimpleId( "scopeType" );
         final String name = "scopeName";
         final Id testKey = new SimpleId( "testKey" );
+        final Id applicationId = new SimpleId( "application" );
 
-        final CollectionScope collectionScope = new CollectionScopeImpl(new SimpleId( "organization" ), testId, name );
-        final ScopedRowKey<CollectionScope, Id>
-                rowKey = new ScopedRowKey<CollectionScope, Id>( collectionScope, testKey );
+        final CollectionPrefixedKey<Id> collectionPrefixedKey = new CollectionPrefixedKey<>( name, testId, testKey );
 
 
-        CollectionScopedRowKeySerializer<Id> collectionScopedRowKeySerializer = 
+        final ScopedRowKey<CollectionPrefixedKey<Id>> rowKey =
+                ScopedRowKey.fromKey( applicationId, collectionPrefixedKey );
+
+
+        CollectionScopedRowKeySerializer<Id> collectionScopedRowKeySerializer =
                 new CollectionScopedRowKeySerializer<Id>( IdRowCompositeSerializer.get() );
 
         ByteBuffer buff = collectionScopedRowKeySerializer.toByteBuffer( rowKey );
 
-        ScopedRowKey<CollectionScope, Id> parsedRowKey = collectionScopedRowKeySerializer.fromByteBuffer( buff );
-
-        assertEquals("Row key serialized correctly", rowKey, parsedRowKey);
+        ScopedRowKey<CollectionPrefixedKey<Id>> parsedRowKey = collectionScopedRowKeySerializer.fromByteBuffer( buff );
 
+        assertEquals( "Row key serialized correctly", rowKey, parsedRowKey );
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5a56dd45/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/BucketScopedRowKey.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/BucketScopedRowKey.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/BucketScopedRowKey.java
index 4ecddcf..0687a7a 100644
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/BucketScopedRowKey.java
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/BucketScopedRowKey.java
@@ -22,9 +22,10 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
+import org.apache.usergrid.persistence.model.entity.Id;
 
 
-public class BucketScopedRowKey<S extends ApplicationScope, K> extends ScopedRowKey<S, K> {
+public class BucketScopedRowKey< K> extends ScopedRowKey< K> {
 
     private final int bucketNumber;
 
@@ -34,12 +35,21 @@ public class BucketScopedRowKey<S extends ApplicationScope, K> extends ScopedRow
      *
      * @param bucketNumber The bucket number for this row key
      */
-    public BucketScopedRowKey( final S scope, final K key, int bucketNumber ) {
+    public BucketScopedRowKey( final Id scope, final K key, int bucketNumber ) {
         super( scope, key );
         this.bucketNumber = bucketNumber;
     }
 
 
+    /**
+     * Get the bucket number
+     * @return
+     */
+    public int getBucketNumber() {
+        return bucketNumber;
+    }
+
+
     @Override
     public boolean equals( final Object o ) {
         if ( this == o ) {
@@ -81,7 +91,7 @@ public class BucketScopedRowKey<S extends ApplicationScope, K> extends ScopedRow
     /**
      * Utility function to generate a new key from the scope
      */
-    public static <S extends ApplicationScope, K> BucketScopedRowKey<S, K> fromKey( final S scope, final K key,
+    public static < K> BucketScopedRowKey< K> fromKey( final Id scope, final K key,
                                                                                     final int bucketNumber ) {
         return new BucketScopedRowKey<>( scope, key, bucketNumber );
     }
@@ -90,9 +100,9 @@ public class BucketScopedRowKey<S extends ApplicationScope, K> extends ScopedRow
     /**
      * Create a list of all buckets from [0,  totalBuckets}.  Note that this is an n-1 0 based system
      */
-    public static <S extends ApplicationScope, K> List<BucketScopedRowKey<S, K>> fromRange( final S scope, final K key, final int totalBuckets ) {
+    public static < K> List<BucketScopedRowKey< K>> fromRange( final Id scope, final K key, final int totalBuckets ) {
 
-        final List<BucketScopedRowKey<S, K>> results = new ArrayList<>( totalBuckets );
+        final List<BucketScopedRowKey< K>> results = new ArrayList<>( totalBuckets );
 
 
         for ( int i = 0; i < totalBuckets; i++ ) {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5a56dd45/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiTennantColumnFamily.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiTennantColumnFamily.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiTennantColumnFamily.java
index 6234184..faaa76d 100644
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiTennantColumnFamily.java
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiTennantColumnFamily.java
@@ -30,17 +30,17 @@ import com.netflix.astyanax.model.ColumnFamily;
  *
  * @author tnine
  */
-public class MultiTennantColumnFamily<S extends ApplicationScope, K, V>
-    extends ColumnFamily<ScopedRowKey<S, K>, V> {
+public class MultiTennantColumnFamily<R extends ScopedRowKey<?>, V >
+    extends ColumnFamily<R, V> {
 
-    public MultiTennantColumnFamily( final String columnFamilyName, final Serializer<ScopedRowKey<S, K>> keySerializer,
+    public MultiTennantColumnFamily( final String columnFamilyName, final Serializer<R> keySerializer,
                                      final Serializer<V> columnSerializer ) {
 
         super( columnFamilyName, keySerializer, columnSerializer );
     }
 
 
-    public MultiTennantColumnFamily( final String columnFamilyName, final Serializer<ScopedRowKey<S, K>> keySerializer,
+    public MultiTennantColumnFamily( final String columnFamilyName, final Serializer<R> keySerializer,
                                      final Serializer<V> columnSerializer, final Serializer<?> defaultValueSerializer ) {
 
         super( columnFamilyName, keySerializer, columnSerializer, defaultValueSerializer );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5a56dd45/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/OrganizationScopedBucketRowKeySerializer.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/OrganizationScopedBucketRowKeySerializer.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/OrganizationScopedBucketRowKeySerializer.java
new file mode 100644
index 0000000..8fddedd
--- /dev/null
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/OrganizationScopedBucketRowKeySerializer.java
@@ -0,0 +1,93 @@
+/*
+ * 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.core.astyanax;
+
+
+import java.nio.ByteBuffer;
+
+import org.apache.usergrid.persistence.core.scope.ApplicationScope;
+import org.apache.usergrid.persistence.core.scope.ApplicationScopeImpl;
+import org.apache.usergrid.persistence.model.entity.Id;
+
+import com.netflix.astyanax.model.CompositeBuilder;
+import com.netflix.astyanax.model.CompositeParser;
+import com.netflix.astyanax.model.Composites;
+import com.netflix.astyanax.serializers.AbstractSerializer;
+import com.netflix.astyanax.serializers.IntegerSerializer;
+
+
+/**
+ * Serializer for serializing CollectionScope + any type into row keys
+ *
+ * @author tnine
+ */
+public class OrganizationScopedBucketRowKeySerializer<K> extends AbstractSerializer<BucketScopedRowKey<K>> {
+
+
+    private static final IdRowCompositeSerializer ID_SER = IdRowCompositeSerializer.get();
+
+
+    /**
+     * The delegate serializer for the key
+     */
+    private final CompositeFieldSerializer<K> keySerializer;
+
+
+
+
+    public OrganizationScopedBucketRowKeySerializer( final CompositeFieldSerializer<K> keySerializer ) {
+        this.keySerializer = keySerializer;
+    }
+
+
+    @Override
+    public ByteBuffer toByteBuffer( final BucketScopedRowKey<K> scopedRowKey ) {
+
+        final CompositeBuilder builder = Composites.newCompositeBuilder();
+
+        //add the organization's id
+        ID_SER.toComposite( builder, scopedRowKey.getScope() );
+
+        //add the bucket
+        builder.addInteger( scopedRowKey.getBucketNumber() );
+
+        //add the key type
+        keySerializer.toComposite( builder, scopedRowKey.getKey() );
+
+        return builder.build();
+    }
+
+
+    @Override
+    public BucketScopedRowKey<K> fromByteBuffer( final ByteBuffer byteBuffer ) {
+        final CompositeParser parser = Composites.newCompositeParser( byteBuffer );
+
+        //read back the id
+        final Id orgId = ID_SER.fromComposite( parser );
+
+        final int bucket = parser.readInteger();
+
+        final K value = keySerializer.fromComposite( parser );
+
+        return new BucketScopedRowKey<>( orgId, value, bucket );
+    }
+}
+
+

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5a56dd45/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/OrganizationScopedRowKeySerializer.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/OrganizationScopedRowKeySerializer.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/OrganizationScopedRowKeySerializer.java
index bdc76dd..4289628 100644
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/OrganizationScopedRowKeySerializer.java
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/OrganizationScopedRowKeySerializer.java
@@ -37,7 +37,7 @@ import com.netflix.astyanax.serializers.AbstractSerializer;
  *
  * @author tnine
  */
-public class OrganizationScopedRowKeySerializer<K> extends AbstractSerializer<ScopedRowKey<ApplicationScope, K>> {
+public class OrganizationScopedRowKeySerializer<K> extends AbstractSerializer<ScopedRowKey<K>> {
 
 
     private static final IdRowCompositeSerializer ID_SER = IdRowCompositeSerializer.get();
@@ -49,18 +49,20 @@ public class OrganizationScopedRowKeySerializer<K> extends AbstractSerializer<Sc
     private final CompositeFieldSerializer<K> keySerializer;
 
 
+
+
     public OrganizationScopedRowKeySerializer( final CompositeFieldSerializer<K> keySerializer ) {
         this.keySerializer = keySerializer;
     }
 
 
     @Override
-    public ByteBuffer toByteBuffer( final ScopedRowKey<ApplicationScope, K> scopedRowKey ) {
+    public ByteBuffer toByteBuffer( final ScopedRowKey< K> scopedRowKey ) {
 
         final CompositeBuilder builder = Composites.newCompositeBuilder();
 
         //add the organization's id
-        ID_SER.toComposite( builder, scopedRowKey.getScope().getApplication() );
+        ID_SER.toComposite( builder, scopedRowKey.getScope() );
 
         //add the key type
         keySerializer.toComposite( builder, scopedRowKey.getKey() );
@@ -70,7 +72,7 @@ public class OrganizationScopedRowKeySerializer<K> extends AbstractSerializer<Sc
 
 
     @Override
-    public ScopedRowKey<ApplicationScope, K> fromByteBuffer( final ByteBuffer byteBuffer ) {
+    public ScopedRowKey<K> fromByteBuffer( final ByteBuffer byteBuffer ) {
         final CompositeParser parser = Composites.newCompositeParser( byteBuffer );
 
         //read back the id
@@ -78,7 +80,7 @@ public class OrganizationScopedRowKeySerializer<K> extends AbstractSerializer<Sc
 
         final K value = keySerializer.fromComposite( parser );
 
-        return new ScopedRowKey<ApplicationScope, K>( new ApplicationScopeImpl( orgId), value );
+        return new ScopedRowKey<K>(  orgId, value );
     }
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5a56dd45/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/ScopedRowKey.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/ScopedRowKey.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/ScopedRowKey.java
index 073abcd..2fe7259 100644
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/ScopedRowKey.java
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/ScopedRowKey.java
@@ -20,6 +20,7 @@ package org.apache.usergrid.persistence.core.astyanax;
 
 
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
+import org.apache.usergrid.persistence.model.entity.Id;
 
 import com.google.common.base.Preconditions;
 
@@ -30,14 +31,14 @@ import com.google.common.base.Preconditions;
  *
  * @author tnine
  */
-public class ScopedRowKey<S extends ApplicationScope, K> {
+public class ScopedRowKey< K> {
 
-    private final S scope;
+    private final Id scope;
 
     private final K key;
 
 
-    public ScopedRowKey( final S scope, final K key ) {
+    public ScopedRowKey( final Id scope, final K key ) {
         Preconditions.checkNotNull( scope, "CollectionScope is required" );
         Preconditions.checkNotNull( key, "Key is required" );
 
@@ -49,7 +50,7 @@ public class ScopedRowKey<S extends ApplicationScope, K> {
     /**
      * Get the stored scope
      */
-    public S getScope() {
+    public Id getScope() {
         return scope;
     }
 
@@ -104,7 +105,7 @@ public class ScopedRowKey<S extends ApplicationScope, K> {
     /**
      * Utility function to generate a new key from the scope
      */
-    public static <S extends ApplicationScope, K> ScopedRowKey<S, K> fromKey( final S scope, K key ) {
-        return new ScopedRowKey<S, K>( scope, key );
+    public static <K> ScopedRowKey< K> fromKey( final Id scope, K key ) {
+        return new ScopedRowKey<>( scope, key );
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5a56dd45/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationImpl.java
index 924eddb..131e426 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationImpl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationImpl.java
@@ -85,26 +85,26 @@ public class EdgeMetadataSerializationImpl implements EdgeMetadataSerialization,
     /**
      * CFs where the row key contains the source node id
      */
-    private static final MultiTennantColumnFamily<ApplicationScope, Id, String> CF_SOURCE_EDGE_TYPES =
-            new MultiTennantColumnFamily<ApplicationScope, Id, String>( "Graph_Source_Edge_Types", ROW_KEY_SER,
+    private static final MultiTennantColumnFamily<ScopedRowKey<Id>, String> CF_SOURCE_EDGE_TYPES =
+            new MultiTennantColumnFamily<>( "Graph_Source_Edge_Types", ROW_KEY_SER,
                     STRING_SERIALIZER );
 
     //all target id types for source edge type
-    private static final MultiTennantColumnFamily<ApplicationScope, EdgeIdTypeKey, String> CF_SOURCE_EDGE_ID_TYPES =
-            new MultiTennantColumnFamily<ApplicationScope, EdgeIdTypeKey, String>( "Graph_Source_Edge_Id_Types",
+    private static final MultiTennantColumnFamily<ScopedRowKey<EdgeIdTypeKey>, String> CF_SOURCE_EDGE_ID_TYPES =
+            new MultiTennantColumnFamily<>( "Graph_Source_Edge_Id_Types",
                     EDGE_TYPE_ROW_KEY, STRING_SERIALIZER );
 
     /**
      * CFs where the row key is the target node id
      */
-    private static final MultiTennantColumnFamily<ApplicationScope, Id, String> CF_TARGET_EDGE_TYPES =
-            new MultiTennantColumnFamily<ApplicationScope, Id, String>( "Graph_Target_Edge_Types", ROW_KEY_SER,
+    private static final MultiTennantColumnFamily<ScopedRowKey<Id>, String> CF_TARGET_EDGE_TYPES =
+            new MultiTennantColumnFamily<>( "Graph_Target_Edge_Types", ROW_KEY_SER,
                     STRING_SERIALIZER );
 
 
     //all source id types for target edge type
-    private static final MultiTennantColumnFamily<ApplicationScope, EdgeIdTypeKey, String> CF_TARGET_EDGE_ID_TYPES =
-            new MultiTennantColumnFamily<ApplicationScope, EdgeIdTypeKey, String>( "Graph_Target_Edge_Id_Types",
+    private static final MultiTennantColumnFamily<ScopedRowKey<EdgeIdTypeKey>, String> CF_TARGET_EDGE_ID_TYPES =
+            new MultiTennantColumnFamily<>( "Graph_Target_Edge_Id_Types",
                     EDGE_TYPE_ROW_KEY, STRING_SERIALIZER );
 
 
@@ -133,7 +133,7 @@ public class EdgeMetadataSerializationImpl implements EdgeMetadataSerialization,
         ValidationUtils.validateApplicationScope( scope );
         GraphValidation.validateEdge( edge );
 
-
+        final Id scopeId = scope.getApplication();
         final Id source = edge.getSourceNode();
         final Id target = edge.getTargetNode();
         final String edgeType = edge.getType();
@@ -143,31 +143,32 @@ public class EdgeMetadataSerializationImpl implements EdgeMetadataSerialization,
                                             .withTimestamp( timestamp );
 
 
+
         //add source->target edge type to meta data
-        final ScopedRowKey<ApplicationScope, Id> sourceKey = new ScopedRowKey<ApplicationScope, Id>( scope, source );
+        final ScopedRowKey< Id> sourceKey = new ScopedRowKey<>( scopeId, source );
 
         batch.withRow( CF_SOURCE_EDGE_TYPES, sourceKey ).putColumn( edgeType, HOLDER );
 
 
         //write source->target edge type and id type to meta data
         EdgeIdTypeKey tk = new EdgeIdTypeKey( source, edgeType );
-        final ScopedRowKey<ApplicationScope, EdgeIdTypeKey> sourceTypeKey =
-                new ScopedRowKey<ApplicationScope, EdgeIdTypeKey>( scope, tk );
+        final ScopedRowKey<EdgeIdTypeKey> sourceTypeKey =
+                new ScopedRowKey<>( scopeId, tk );
 
 
         batch.withRow( CF_SOURCE_EDGE_ID_TYPES, sourceTypeKey ).putColumn( target.getType(), HOLDER );
 
 
         //write target<--source edge type meta data
-        final ScopedRowKey<ApplicationScope, Id> targetKey = new ScopedRowKey<ApplicationScope, Id>( scope, target );
+        final ScopedRowKey< Id> targetKey = new ScopedRowKey<>( scopeId, target );
 
 
         batch.withRow( CF_TARGET_EDGE_TYPES, targetKey ).putColumn( edgeType, HOLDER );
 
 
         //write target<--source edge type and id type to meta data
-        final ScopedRowKey<ApplicationScope, EdgeIdTypeKey> targetTypeKey =
-                new ScopedRowKey<ApplicationScope, EdgeIdTypeKey>( scope, new EdgeIdTypeKey( target, edgeType ) );
+        final ScopedRowKey<EdgeIdTypeKey> targetTypeKey =
+                new ScopedRowKey<>( scopeId, new EdgeIdTypeKey( target, edgeType ) );
 
 
         batch.withRow( CF_TARGET_EDGE_ID_TYPES, targetTypeKey ).putColumn( source.getType(), HOLDER );
@@ -242,11 +243,11 @@ public class EdgeMetadataSerializationImpl implements EdgeMetadataSerialization,
      */
     private MutationBatch removeEdgeType( final ApplicationScope scope, final Id rowKeyId, final String edgeType,
                                           final long version,
-                                          final MultiTennantColumnFamily<ApplicationScope, Id, String> cf ) {
+                                          final MultiTennantColumnFamily<ScopedRowKey<Id>, String> cf ) {
 
 
         //write target<--source edge type meta data
-        final ScopedRowKey<ApplicationScope, Id> rowKey = new ScopedRowKey<ApplicationScope, Id>( scope, rowKeyId );
+        final ScopedRowKey< Id> rowKey = new ScopedRowKey< Id>( scope.getApplication(), rowKeyId );
 
         final MutationBatch batch = keyspace.prepareMutationBatch().withTimestamp( version );
 
@@ -270,15 +271,15 @@ public class EdgeMetadataSerializationImpl implements EdgeMetadataSerialization,
      */
     private MutationBatch removeIdType( final ApplicationScope scope, final Id rowId, final String idType,
                                         final String edgeType, final long version,
-                                        final MultiTennantColumnFamily<ApplicationScope, EdgeIdTypeKey, String> cf ) {
+                                        final MultiTennantColumnFamily<ScopedRowKey<EdgeIdTypeKey>, String> cf ) {
 
 
         final MutationBatch batch = keyspace.prepareMutationBatch().withTimestamp( version );
 
 
         //write target<--source edge type and id type to meta data
-        final ScopedRowKey<ApplicationScope, EdgeIdTypeKey> rowKey =
-                new ScopedRowKey<ApplicationScope, EdgeIdTypeKey>( scope, new EdgeIdTypeKey( rowId, edgeType ) );
+        final ScopedRowKey< EdgeIdTypeKey> rowKey =
+                new ScopedRowKey<>( scope.getApplication(), new EdgeIdTypeKey( rowId, edgeType ) );
 
 
         batch.withRow( cf, rowKey ).deleteColumn( idType );
@@ -313,12 +314,12 @@ public class EdgeMetadataSerializationImpl implements EdgeMetadataSerialization,
      * @param cf The column family to execute on
      */
     private Iterator<String> getEdgeTypes( final ApplicationScope scope, final SearchEdgeType search,
-                                           final MultiTennantColumnFamily<ApplicationScope, Id, String> cf ) {
+                                           final MultiTennantColumnFamily<ScopedRowKey<Id>, String> cf ) {
         ValidationUtils.validateApplicationScope( scope );
         GraphValidation.validateSearchEdgeType( search );
 
 
-        final ScopedRowKey<ApplicationScope, Id> sourceKey = new ScopedRowKey<>( scope, search.getNode() );
+        final ScopedRowKey< Id> sourceKey = new ScopedRowKey<>( scope.getApplication(), search.getNode() );
 
 
         //resume from the last if specified.  Also set the range
@@ -326,7 +327,7 @@ public class EdgeMetadataSerializationImpl implements EdgeMetadataSerialization,
 
         final RangeBuilder rangeBuilder = createRange( search );
 
-        RowQuery<ScopedRowKey<ApplicationScope, Id>, String> query =
+        RowQuery<ScopedRowKey<Id>, String> query =
                 keyspace.prepareQuery( cf ).getKey( sourceKey ).autoPaginate( true )
                         .withColumnRange( rangeBuilder.build() );
 
@@ -348,19 +349,19 @@ public class EdgeMetadataSerializationImpl implements EdgeMetadataSerialization,
      * @param cf The column family to search
      */
     public Iterator<String> getIdTypes( final ApplicationScope scope, final SearchIdType search,
-                                        final MultiTennantColumnFamily<ApplicationScope, EdgeIdTypeKey, String> cf ) {
+                                        final MultiTennantColumnFamily<ScopedRowKey<EdgeIdTypeKey>, String> cf ) {
         ValidationUtils.validateApplicationScope( scope );
         GraphValidation.validateSearchEdgeIdType( search );
 
 
-        final ScopedRowKey<ApplicationScope, EdgeIdTypeKey> sourceTypeKey =
-                new ScopedRowKey<>( scope, new EdgeIdTypeKey( search.getNode(), search.getEdgeType() ) );
+        final ScopedRowKey<EdgeIdTypeKey> sourceTypeKey =
+                new ScopedRowKey<>( scope.getApplication(), new EdgeIdTypeKey( search.getNode(), search.getEdgeType() ) );
 
 
         final RangeBuilder rangeBuilder = createRange( search );
 
 
-        RowQuery<ScopedRowKey<ApplicationScope, EdgeIdTypeKey>, String> query =
+        RowQuery<ScopedRowKey<EdgeIdTypeKey>, String> query =
                 keyspace.prepareQuery( cf ).getKey( sourceTypeKey ).autoPaginate( true )
                         .withColumnRange( rangeBuilder.build() );
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5a56dd45/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/NodeSerializationImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/NodeSerializationImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/NodeSerializationImpl.java
index b14fad6..0febf96 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/NodeSerializationImpl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/NodeSerializationImpl.java
@@ -88,8 +88,8 @@ public class NodeSerializationImpl implements NodeSerialization, Migration {
      * BloomFilter on read.  This means our performance will be no worse than checking a distributed cache in RAM for
      * the existence of a marked node.
      */
-    private static final MultiTennantColumnFamily<ApplicationScope, Id, Boolean> GRAPH_DELETE =
-            new MultiTennantColumnFamily<ApplicationScope, Id, Boolean>( "Graph_Marked_Nodes",
+    private static final MultiTennantColumnFamily<ScopedRowKey<Id>, Boolean> GRAPH_DELETE =
+            new MultiTennantColumnFamily<>( "Graph_Marked_Nodes",
                     new OrganizationScopedRowKeySerializer<Id>( ROW_SERIALIZER ), BOOLEAN_SERIALIZER );
 
 
@@ -121,7 +121,7 @@ public class NodeSerializationImpl implements NodeSerialization, Migration {
 
         MutationBatch batch = keyspace.prepareMutationBatch().withConsistencyLevel( fig.getWriteCL() );
 
-        batch.withRow( GRAPH_DELETE, ScopedRowKey.fromKey( scope, node ) ).setTimestamp( timestamp )
+        batch.withRow( GRAPH_DELETE, ScopedRowKey.fromKey( scope.getApplication(), node ) ).setTimestamp( timestamp )
              .putColumn( COLUMN_NAME, timestamp );
 
         return batch;
@@ -136,7 +136,7 @@ public class NodeSerializationImpl implements NodeSerialization, Migration {
 
         MutationBatch batch = keyspace.prepareMutationBatch().withConsistencyLevel( fig.getWriteCL() );
 
-        batch.withRow( GRAPH_DELETE, ScopedRowKey.fromKey( scope, node ) ).setTimestamp( timestamp )
+        batch.withRow( GRAPH_DELETE, ScopedRowKey.fromKey( scope.getApplication(), node ) ).setTimestamp( timestamp )
              .deleteColumn( COLUMN_NAME );
 
         return batch;
@@ -148,13 +148,13 @@ public class NodeSerializationImpl implements NodeSerialization, Migration {
         ValidationUtils.validateApplicationScope( scope );
         ValidationUtils.verifyIdentity( node );
 
-        ColumnFamilyQuery<ScopedRowKey<ApplicationScope, Id>, Boolean> query =
+        ColumnFamilyQuery<ScopedRowKey<Id>, Boolean> query =
                 keyspace.prepareQuery( GRAPH_DELETE ).setConsistencyLevel( fig.getReadCL() );
 
 
         try {
             Column<Boolean> result = HystrixCassandra
-                    .user( query.getKey( ScopedRowKey.fromKey( scope, node ) ).getColumn( COLUMN_NAME ) )
+                    .user( query.getKey( ScopedRowKey.fromKey( scope.getApplication(), node ) ).getColumn( COLUMN_NAME ) )
                     .getResult();
 
             return Optional.of( result.getLongValue() );
@@ -177,27 +177,29 @@ public class NodeSerializationImpl implements NodeSerialization, Migration {
         Preconditions.checkNotNull( edges, "edges cannot be null" );
 
 
-        final ColumnFamilyQuery<ScopedRowKey<ApplicationScope, Id>, Boolean> query =
+        final ColumnFamilyQuery<ScopedRowKey< Id>, Boolean> query =
                 keyspace.prepareQuery( GRAPH_DELETE ).setConsistencyLevel( fig.getReadCL() );
 
 
-        final List<ScopedRowKey<ApplicationScope, Id>> keys =
-                new ArrayList<ScopedRowKey<ApplicationScope, Id>>( edges.size() );
+        final List<ScopedRowKey< Id>> keys =
+                new ArrayList<>( edges.size() );
 
         //worst case all are marked
         final Map<Id, Long> versions = new HashMap<>( edges.size() );
 
+        final Id scopeId = scope.getApplication();
+
         for ( final Edge edge : edges ) {
-            keys.add( ScopedRowKey.fromKey( scope, edge.getSourceNode() ) );
-            keys.add( ScopedRowKey.fromKey( scope, edge.getTargetNode() ) );
+            keys.add( ScopedRowKey.fromKey( scopeId, edge.getSourceNode() ) );
+            keys.add( ScopedRowKey.fromKey( scopeId, edge.getTargetNode() ) );
         }
 
 
-        final Rows<ScopedRowKey<ApplicationScope, Id>, Boolean> results = HystrixCassandra
+        final Rows<ScopedRowKey<Id>, Boolean> results = HystrixCassandra
                 .user( query.getRowSlice( keys ).withColumnSlice( Collections.singletonList( COLUMN_NAME ) ) )
                 .getResult();
 
-        for ( Row<ScopedRowKey<ApplicationScope, Id>, Boolean> row : results ) {
+        for ( Row<ScopedRowKey<Id>, Boolean> row : results ) {
             Column<Boolean> column = row.getColumns().getColumnByName( COLUMN_NAME );
 
             if ( column != null ) {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5a56dd45/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeColumnFamilies.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeColumnFamilies.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeColumnFamilies.java
index 6f6c72d..a7b5128 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeColumnFamilies.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeColumnFamilies.java
@@ -22,6 +22,7 @@ package org.apache.usergrid.persistence.graph.serialization.impl.shard;
 
 
 import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamily;
+import org.apache.usergrid.persistence.core.astyanax.ScopedRowKey;
 import org.apache.usergrid.persistence.core.migration.Migration;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 
@@ -34,27 +35,27 @@ public interface EdgeColumnFamilies extends Migration{
     /**
      * Get the name of the column family for getting source nodes
      */
-    public MultiTennantColumnFamily<ApplicationScope, RowKey, DirectedEdge> getSourceNodeCfName();
+    public MultiTennantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> getSourceNodeCfName();
 
     /**
      * Get the name of the column family for getting target nodes
      */
-    public MultiTennantColumnFamily<ApplicationScope, RowKey, DirectedEdge> getTargetNodeCfName();
+    public MultiTennantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> getTargetNodeCfName();
 
 
     /**
      * Get the name of the column family for getting source nodes  with a target type
      */
-    public MultiTennantColumnFamily<ApplicationScope, RowKeyType, DirectedEdge> getSourceNodeTargetTypeCfName();
+    public MultiTennantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> getSourceNodeTargetTypeCfName();
 
     /**
      * Get the name of the column family for getting target nodes with a source type
      */
-    public MultiTennantColumnFamily<ApplicationScope, RowKeyType, DirectedEdge> getTargetNodeSourceTypeCfName();
+    public MultiTennantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> getTargetNodeSourceTypeCfName();
 
     /**
      * Get the Graph edge versions cf
      * @return
      */
-    public MultiTennantColumnFamily<ApplicationScope, EdgeRowKey, Long> getGraphEdgeVersions();
+    public MultiTennantColumnFamily<ScopedRowKey<EdgeRowKey>, Long> getGraphEdgeVersions();
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5a56dd45/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardCounterSerializationImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardCounterSerializationImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardCounterSerializationImpl.java
index 749416c..7c267a0 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardCounterSerializationImpl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/count/NodeShardCounterSerializationImpl.java
@@ -66,7 +66,7 @@ public class NodeShardCounterSerializationImpl implements NodeShardCounterSerial
     /**
      * Edge shards
      */
-    private static final MultiTennantColumnFamily<ApplicationScope, ShardKey, Boolean> EDGE_SHARD_COUNTS =
+    private static final MultiTennantColumnFamily<ScopedRowKey<ShardKey>, Boolean> EDGE_SHARD_COUNTS =
             new MultiTennantColumnFamily<>( "Edge_Shard_Counts",
                     new OrganizationScopedRowKeySerializer<>( SHARD_KEY_SERIALIZER ), BooleanSerializer.get() );
 
@@ -100,7 +100,7 @@ public class NodeShardCounterSerializationImpl implements NodeShardCounterSerial
             final long value = entry.getValue().get();
 
 
-            final ScopedRowKey rowKey = ScopedRowKey.fromKey( key.scope, key );
+            final ScopedRowKey rowKey = ScopedRowKey.fromKey( key.scope.getApplication(), key );
 
 
             batch.withRow( EDGE_SHARD_COUNTS, rowKey ).incrementCounterColumn(true , value );
@@ -114,7 +114,7 @@ public class NodeShardCounterSerializationImpl implements NodeShardCounterSerial
     @Override
     public long getCount( final ShardKey key ) {
 
-        final ScopedRowKey rowKey = ScopedRowKey.fromKey( key.scope, key );
+        final ScopedRowKey rowKey = ScopedRowKey.fromKey( key.scope.getApplication(), key );
 
 
         try {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5a56dd45/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/EdgeSearcher.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/EdgeSearcher.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/EdgeSearcher.java
index 413c2a3..e1800c0 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/EdgeSearcher.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/EdgeSearcher.java
@@ -54,14 +54,14 @@ public abstract class EdgeSearcher<R, C, T> implements ColumnParser<C, T>, Colum
 
 
 
-    public List<ScopedRowKey<ApplicationScope, R>> getRowKeys() {
+    public List<ScopedRowKey<R>> getRowKeys() {
 
-        List<ScopedRowKey<ApplicationScope, R>> rowKeys = new ArrayList<>(shards.size());
+        List<ScopedRowKey<R>> rowKeys = new ArrayList<>(shards.size());
 
         for(Shard shard : shards){
 
-            final ScopedRowKey<ApplicationScope, R> rowKey = ScopedRowKey
-                    .fromKey( scope, generateRowKey(shard.getShardIndex() ) );
+            final ScopedRowKey< R> rowKey = ScopedRowKey
+                    .fromKey( scope.getApplication(), generateRowKey(shard.getShardIndex() ) );
 
             rowKeys.add( rowKey );
         }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/5a56dd45/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/EdgeShardSerializationImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/EdgeShardSerializationImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/EdgeShardSerializationImpl.java
index 3b1f37a..4fd3155 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/EdgeShardSerializationImpl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/EdgeShardSerializationImpl.java
@@ -61,7 +61,7 @@ public class EdgeShardSerializationImpl implements EdgeShardSerialization {
     /**
      * Edge shards
      */
-    private static final MultiTennantColumnFamily<ApplicationScope, DirectedEdgeMeta, Long> EDGE_SHARDS =
+    private static final MultiTennantColumnFamily<ScopedRowKey<DirectedEdgeMeta>, Long> EDGE_SHARDS =
             new MultiTennantColumnFamily<>( "Edge_Shards",
                     new OrganizationScopedRowKeySerializer<>( EdgeShardRowKeySerializer.INSTANCE ), LongSerializer.get() );
 
@@ -96,7 +96,7 @@ public class EdgeShardSerializationImpl implements EdgeShardSerialization {
         Preconditions.checkArgument( shard.getShardIndex() > -1, "shardid must be greater than -1" );
         Preconditions.checkArgument( shard.getCreatedTime() > -1, "createdTime must be greater than -1" );
 
-        final ScopedRowKey rowKey = ScopedRowKey.fromKey( scope, metaData );
+        final ScopedRowKey rowKey = ScopedRowKey.fromKey( scope.getApplication(), metaData );
 
         final MutationBatch batch = keyspace.prepareMutationBatch();
 
@@ -130,10 +130,10 @@ public class EdgeShardSerializationImpl implements EdgeShardSerialization {
         }
 
 
-        final ScopedRowKey rowKey = ScopedRowKey.fromKey( scope, metaData );
+        final ScopedRowKey rowKey = ScopedRowKey.fromKey( scope.getApplication(), metaData );
 
 
-        final RowQuery<ScopedRowKey<ApplicationScope, DirectedEdgeMeta>, Long> query =
+        final RowQuery<ScopedRowKey<DirectedEdgeMeta>, Long> query =
                 keyspace.prepareQuery( EDGE_SHARDS ).setConsistencyLevel( cassandraConfig.getReadCL() ).getKey( rowKey )
                         .autoPaginate( true ).withColumnRange( rangeBuilder.build() );
 
@@ -152,7 +152,7 @@ public class EdgeShardSerializationImpl implements EdgeShardSerialization {
 
 
 
-        final ScopedRowKey rowKey = ScopedRowKey.fromKey( scope, metaData );
+        final ScopedRowKey rowKey = ScopedRowKey.fromKey( scope.getApplication(), metaData );
 
         final MutationBatch batch = keyspace.prepareMutationBatch();