usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject git commit: adding delete
Date Thu, 02 Oct 2014 19:11:17 GMT
Repository: incubator-usergrid
Updated Branches:
  refs/heads/map 587cb5a73 -> 25e850471


adding delete


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

Branch: refs/heads/map
Commit: 25e8504714671def3924ce32fb1e756875701973
Parents: 587cb5a
Author: Shawn Feldman <sfeldman@apache.org>
Authored: Thu Oct 2 13:11:04 2014 -0600
Committer: Shawn Feldman <sfeldman@apache.org>
Committed: Thu Oct 2 13:11:04 2014 -0600

----------------------------------------------------------------------
 stack/corepersistence/map/pom.xml               |  1 +
 .../persistence/map/impl/MapManagerImpl.java    | 12 ++---
 .../map/impl/MapSerializationImpl.java          | 47 +++++++++++++-------
 3 files changed, 38 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/25e85047/stack/corepersistence/map/pom.xml
----------------------------------------------------------------------
diff --git a/stack/corepersistence/map/pom.xml b/stack/corepersistence/map/pom.xml
index cf88702..93b1030 100644
--- a/stack/corepersistence/map/pom.xml
+++ b/stack/corepersistence/map/pom.xml
@@ -13,6 +13,7 @@
   <description>The module for handling map operations</description>
 
   <artifactId>map</artifactId>
+  <name>Usergrid Map</name>
 
   <dependencies>
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/25e85047/stack/corepersistence/map/src/main/java/org/apache/usergrid/persistence/map/impl/MapManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/map/src/main/java/org/apache/usergrid/persistence/map/impl/MapManagerImpl.java
b/stack/corepersistence/map/src/main/java/org/apache/usergrid/persistence/map/impl/MapManagerImpl.java
index 7ae1214..7b5062b 100644
--- a/stack/corepersistence/map/src/main/java/org/apache/usergrid/persistence/map/impl/MapManagerImpl.java
+++ b/stack/corepersistence/map/src/main/java/org/apache/usergrid/persistence/map/impl/MapManagerImpl.java
@@ -73,7 +73,7 @@ public class MapManagerImpl implements MapManager {
 
     @Override
     public String getString( final String key ) {
-         return mapSerialization.getString( scope, key );
+        return mapSerialization.getString( scope, key );
     }
 
 
@@ -85,31 +85,31 @@ public class MapManagerImpl implements MapManager {
 
     @Override
     public UUID getUuid( final String key ) {
-        return null;
+        return mapSerialization.getUuid(scope,key);
     }
 
 
     @Override
     public UUID putUuid( final String key, final UUID putUuid ) {
-        return null;
+        return mapSerialization.putUuid(scope,key,putUuid);
     }
 
 
     @Override
     public Long getLong( final String key ) {
-        return null;
+        return mapSerialization.getLong(scope,key);
     }
 
 
     @Override
     public Long putLong( final String key, final Long value ) {
-        return null;
+        return mapSerialization.putLong(scope,key,value);
     }
 
 
     @Override
     public void delete( final String key ) {
-
+        mapSerialization.delete(scope,key);
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/25e85047/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 0475a75..54bb77b 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
@@ -112,29 +112,26 @@ public class MapSerializationImpl implements MapSerialization {
     public void putString( final MapScope scope, final String key, final String value ) {
         final MutationBatch batch = keyspace.prepareMutationBatch();
 
-                //add it to the entry
-                final ScopedRowKey<ApplicationScope, MapEntryKey> entryRowKey = MapEntryKey.fromKey(
scope, key );
+        //add it to the entry
+        final ScopedRowKey<ApplicationScope, MapEntryKey> entryRowKey = MapEntryKey.fromKey(scope,
key);
 
-                //serialize to the entry
-                batch.withRow( MAP_ENTRIES, entryRowKey ).putColumn( true, value );
+        //serialize to the entry
+        batch.withRow(MAP_ENTRIES, entryRowKey).putColumn(true, value);
 
-                //add it to the keys
+        //add it to the keys
 
-                final ScopedRowKey<ApplicationScope, String> keyRowKey =
-                        ScopedRowKey.fromKey( ( ApplicationScope ) scope, key );
+        final ScopedRowKey<ApplicationScope, String> keyRowKey =
+                ScopedRowKey.fromKey((ApplicationScope) scope, key);
 
-                //serialize to the entry
-                batch.withRow( MAP_KEYS, keyRowKey ).putColumn( key, true );
+        //serialize to the entry
+        batch.withRow(MAP_KEYS, keyRowKey).putColumn(key, true);
 
-                try {
-                    batch.execute();
-                }
-                catch ( ConnectionException e ) {
-                    throw new RuntimeException( "Unable to connect to cassandra", e );
-                }
+        executeBatch(batch);
     }
 
 
+
+
     @Override
     public UUID getUuid( final MapScope scope, final String key ) {
         return null;
@@ -161,7 +158,19 @@ public class MapSerializationImpl implements MapSerialization {
 
     @Override
     public void delete( final MapScope scope, final String key ) {
+        final MutationBatch batch = keyspace.prepareMutationBatch();
+        final ScopedRowKey<ApplicationScope, MapEntryKey> entryRowKey = MapEntryKey.fromKey(scope,
key);
+
+        //serialize to the entry
+        batch.withRow(MAP_ENTRIES, entryRowKey).delete();
+
+        //add it to the keys
 
+        final ScopedRowKey<ApplicationScope, String> keyRowKey = ScopedRowKey.fromKey((ApplicationScope)
scope, key);
+
+        //serialize to the entry
+        batch.withRow(MAP_KEYS, keyRowKey).delete();
+        executeBatch(batch);
     }
 
 
@@ -178,7 +187,13 @@ public class MapSerializationImpl implements MapSerialization {
         return Arrays.asList( mapEntries, mapKeys );
     }
 
-
+    private void executeBatch(MutationBatch batch) {
+        try {
+            batch.execute();
+        } catch (ConnectionException e) {
+            throw new RuntimeException("Unable to connect to cassandra", e);
+        }
+    }
     /**
      * Inner class to serialize and edgeIdTypeKey
      */


Mime
View raw message