usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject [5/5] incubator-usergrid git commit: Fixes ttl on map entry keys
Date Tue, 10 Mar 2015 18:37:23 GMT
Fixes ttl on map entry keys


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

Branch: refs/heads/two-dot-o
Commit: 06e7ad6c059ed295238c24a2610e2047bf79c0d4
Parents: 5d95ebb
Author: Todd Nine <tnine@apigee.com>
Authored: Tue Mar 10 12:19:23 2015 -0600
Committer: Todd Nine <tnine@apigee.com>
Committed: Tue Mar 10 12:19:23 2015 -0600

----------------------------------------------------------------------
 .../map/impl/MapSerializationImpl.java          | 37 +++++++++++++++-----
 1 file changed, 29 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/06e7ad6c/stack/corepersistence/map/src/main/java/org/apache/usergrid/persistence/map/impl/MapSerializationImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/map/src/main/java/org/apache/usergrid/persistence/map/impl/MapSerializationImpl.java
b/stack/corepersistence/map/src/main/java/org/apache/usergrid/persistence/map/impl/MapSerializationImpl.java
index d3bd3c5..715c202 100644
--- a/stack/corepersistence/map/src/main/java/org/apache/usergrid/persistence/map/impl/MapSerializationImpl.java
+++ b/stack/corepersistence/map/src/main/java/org/apache/usergrid/persistence/map/impl/MapSerializationImpl.java
@@ -129,10 +129,15 @@ public class MapSerializationImpl implements MapSerialization {
     public void putString( final MapScope scope, final String key, final String value ) {
         final RowOp op = new RowOp() {
             @Override
-            public void rowOp( final ScopedRowKey<MapEntryKey> scopedRowKey,
-                               final ColumnListMutation<Boolean> columnListMutation
) {
+            public void putValue(final ColumnListMutation<Boolean> columnListMutation
) {
                 columnListMutation.putColumn( true, value );
             }
+
+
+            @Override
+            public void putKey(final ColumnListMutation<String> keysMutation ) {
+                keysMutation.putColumn( key, true );
+            }
         };
 
 
@@ -146,10 +151,15 @@ public class MapSerializationImpl implements MapSerialization {
 
         final RowOp op = new RowOp() {
             @Override
-            public void rowOp( final ScopedRowKey<MapEntryKey> scopedRowKey,
-                               final ColumnListMutation<Boolean> columnListMutation
) {
+            public void putValue( final ColumnListMutation<Boolean> columnListMutation
) {
                 columnListMutation.putColumn( true, value, ttl );
             }
+
+
+            @Override
+            public void putKey( final ColumnListMutation<String> keysMutation ) {
+                keysMutation.putColumn( key, true, ttl );
+            }
         };
 
 
@@ -179,7 +189,7 @@ public class MapSerializationImpl implements MapSerialization {
         // entry
 
 
-        rowOp.rowOp( entryRowKey, batch.withRow( MAP_ENTRIES, entryRowKey ) );
+        rowOp.putValue( batch.withRow( MAP_ENTRIES, entryRowKey ) );
 
 
         //add it to the keys
@@ -189,20 +199,31 @@ public class MapSerializationImpl implements MapSerialization {
         final BucketScopedRowKey<String> keyRowKey = BucketScopedRowKey.fromKey( scope.getApplication(),
key, bucket );
 
         //serialize to the entry
-        batch.withRow( MAP_KEYS, keyRowKey ).putColumn( key, true );
+
+        rowOp.putKey( batch.withRow( MAP_KEYS, keyRowKey ) );
 
 
         executeBatch( batch );
     }
 
+
+    /**
+     * Callbacks for performing row operations
+     */
     private static interface RowOp{
 
         /**
          * Callback to do the row
-         * @param scopedRowKey The row key
          * @param columnListMutation The column mutation
          */
-        void rowOp(final ScopedRowKey<MapEntryKey> scopedRowKey, final ColumnListMutation<Boolean>
columnListMutation);
+        void putValue( final ColumnListMutation<Boolean> columnListMutation );
+
+
+        /**
+         * Write the key
+         * @param keysMutation
+         */
+        void putKey( final ColumnListMutation<String> keysMutation );
 
 
     }


Mime
View raw message