usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From toddn...@apache.org
Subject git commit: WIP. Need to finish creating pipelines etc before merging.
Date Tue, 03 Dec 2013 03:29:57 GMT
Updated Branches:
  refs/heads/two-dot-o-async-hacks b2833c39e -> 271b26c8b


WIP.  Need to finish creating pipelines etc before merging.


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

Branch: refs/heads/two-dot-o-async-hacks
Commit: 271b26c8b25fa7e0f2250a35bc8e8caf78984581
Parents: b2833c3
Author: Todd Nine <toddnine@apache.org>
Authored: Mon Dec 2 20:29:39 2013 -0700
Committer: Todd Nine <toddnine@apache.org>
Committed: Mon Dec 2 20:29:39 2013 -0700

----------------------------------------------------------------------
 .../collection/guice/CollectionModule.java      |  2 +-
 .../collection/mvcc/stage/StagePipeline.java    |  1 +
 .../collection/mvcc/stage/WriteContext.java     |  2 +-
 .../stage/impl/CollectionPipelineModule.java    | 11 -------
 .../mvcc/stage/impl/CreatePipeline.java         |  4 +--
 .../mvcc/stage/impl/StagePipelineImpl.java      |  4 ---
 .../collection/mvcc/stage/impl/Start.java       |  5 +--
 .../mvcc/stage/impl/WriteContextCallback.java   | 34 ++++++++++++++++++++
 8 files changed, 42 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/271b26c8/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/guice/CollectionModule.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/guice/CollectionModule.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/guice/CollectionModule.java
index e675e88..5f5d544 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/guice/CollectionModule.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/guice/CollectionModule.java
@@ -6,9 +6,9 @@ import org.apache.usergrid.persistence.collection.migration.Migration;
 import org.apache.usergrid.persistence.collection.migration.MigrationManager;
 import org.apache.usergrid.persistence.collection.migration.MigrationManagerImpl;
 import org.apache.usergrid.persistence.collection.mvcc.stage.StagePipeline;
-import org.apache.usergrid.persistence.collection.mvcc.stage.impl.UpdatePipeline;
 import org.apache.usergrid.persistence.collection.mvcc.stage.impl.CreatePipeline;
 import org.apache.usergrid.persistence.collection.mvcc.stage.impl.DeletePipeline;
+import org.apache.usergrid.persistence.collection.mvcc.stage.impl.UpdatePipeline;
 import org.apache.usergrid.persistence.collection.serialization.MvccEntitySerializationStrategy;
 import org.apache.usergrid.persistence.collection.serialization.MvccEntitySerializationStrategyImpl;
 import org.apache.usergrid.persistence.collection.serialization.MvccLogEntrySerializationStrategy;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/271b26c8/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/StagePipeline.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/StagePipeline.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/StagePipeline.java
index 30b274c..562d852 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/StagePipeline.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/StagePipeline.java
@@ -15,6 +15,7 @@ public interface StagePipeline {
      */
     public WriteStage next();
 
+
     /**
      * Insert a new stage directly after the current stage.  This can be used
      * to add additional validation during write phases depending on the mvcc entity

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/271b26c8/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/WriteContext.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/WriteContext.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/WriteContext.java
index 38aa9d4..42cb6ab 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/WriteContext.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/WriteContext.java
@@ -18,7 +18,7 @@ public interface WriteContext {
      * Perform the write in the context with the specified entity
      * @param entity
      */
-    void performWrite(MvccEntity entity);
+    void nextStage(MvccEntity entity);
 
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/271b26c8/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/CollectionPipelineModule.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/CollectionPipelineModule.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/CollectionPipelineModule.java
index 67ca516..809d92f 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/CollectionPipelineModule.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/CollectionPipelineModule.java
@@ -1,24 +1,13 @@
 package org.apache.usergrid.persistence.collection.mvcc.stage.impl;
 
 
-import org.apache.usergrid.persistence.collection.astynax.AstynaxKeyspaceProvider;
-import org.apache.usergrid.persistence.collection.guice.PropertyUtils;
-import org.apache.usergrid.persistence.collection.migration.Migration;
-import org.apache.usergrid.persistence.collection.migration.MigrationManager;
-import org.apache.usergrid.persistence.collection.migration.MigrationManagerImpl;
 import org.apache.usergrid.persistence.collection.mvcc.stage.StagePipeline;
-import org.apache.usergrid.persistence.collection.mvcc.stage.WriteStage;
 import org.apache.usergrid.persistence.collection.serialization.MvccEntitySerializationStrategy;
-import org.apache.usergrid.persistence.collection.serialization.MvccEntitySerializationStrategyImpl;
 import org.apache.usergrid.persistence.collection.serialization.MvccLogEntrySerializationStrategy;
-import org.apache.usergrid.persistence.collection.serialization.MvccLogEntrySerializationStrategyImpl;
 
 import com.google.inject.AbstractModule;
 import com.google.inject.Inject;
 import com.google.inject.Provides;
-import com.google.inject.multibindings.Multibinder;
-import com.google.inject.name.Names;
-import com.netflix.astyanax.Keyspace;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/271b26c8/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/CreatePipeline.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/CreatePipeline.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/CreatePipeline.java
index fb7e7c1..e700940 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/CreatePipeline.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/CreatePipeline.java
@@ -6,10 +6,10 @@ import java.lang.annotation.Target;
 
 import com.google.inject.BindingAnnotation;
 
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import static java.lang.annotation.ElementType.PARAMETER;
 import static java.lang.annotation.ElementType.FIELD;
 import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/271b26c8/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/StagePipelineImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/StagePipelineImpl.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/StagePipelineImpl.java
index 5de58c5..b63769b 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/StagePipelineImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/StagePipelineImpl.java
@@ -1,13 +1,9 @@
 package org.apache.usergrid.persistence.collection.mvcc.stage.impl;
 
 
-import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.List;
-import java.util.NoSuchElementException;
 
-import org.apache.usergrid.persistence.collection.mvcc.entity.Stage;
 import org.apache.usergrid.persistence.collection.mvcc.stage.StagePipeline;
 import org.apache.usergrid.persistence.collection.mvcc.stage.WriteStage;
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/271b26c8/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/Start.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/Start.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/Start.java
index 6d4b63c..d86276d 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/Start.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/Start.java
@@ -12,6 +12,7 @@ import org.apache.usergrid.persistence.collection.mvcc.stage.WriteContext;
 import org.apache.usergrid.persistence.collection.mvcc.stage.WriteStage;
 import org.apache.usergrid.persistence.collection.serialization.MvccLogEntrySerializationStrategy;
 
+import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
@@ -57,8 +58,8 @@ public class Start implements WriteStage {
           throw new RuntimeException( "Failed to execute write asynchronously ", e );
         }
 
-        //todo next stage invocation
-        //Futures.addCallback();
+        //set the next stage to invoke on return
+        Futures.addCallback(future, new WriteContextCallback(context, entity));
 
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/271b26c8/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/WriteContextCallback.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/WriteContextCallback.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/WriteContextCallback.java
new file mode 100644
index 0000000..0fa408a
--- /dev/null
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/impl/WriteContextCallback.java
@@ -0,0 +1,34 @@
+package org.apache.usergrid.persistence.collection.mvcc.stage.impl;
+
+
+import org.apache.usergrid.persistence.collection.mvcc.entity.MvccEntity;
+import org.apache.usergrid.persistence.collection.mvcc.stage.WriteContext;
+
+import com.google.common.util.concurrent.FutureCallback;
+import com.netflix.astyanax.connectionpool.OperationResult;
+
+
+/** @author tnine */
+public class WriteContextCallback implements FutureCallback<OperationResult<Void>>
{
+
+    private final WriteContext context;
+    private final MvccEntity entity;
+
+
+    public WriteContextCallback( final WriteContext context, final MvccEntity entity ) {
+        this.context = context;
+        this.entity = entity;
+    }
+
+
+    public void onSuccess( final OperationResult<Void> result ) {
+        //proceed to the next stage
+        context.nextStage( entity );
+    }
+
+
+    @Override
+    public void onFailure( final Throwable t ) {
+        throw new RuntimeException( "Failed to execute write", t );
+    }
+}


Mime
View raw message