You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by sr...@apache.org on 2015/11/21 21:23:14 UTC
storm git commit: Merge branch 'STORM-1221' of
https://github.com/haohui/storm into STORM-1221-V3
Repository: storm
Updated Branches:
refs/heads/STORM-1040 8948a3344 -> b15e7f9c4
Merge branch 'STORM-1221' of https://github.com/haohui/storm into STORM-1221-V3
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/b15e7f9c
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/b15e7f9c
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/b15e7f9c
Branch: refs/heads/STORM-1040
Commit: b15e7f9c4dc2c5d78346120a21f535d74a532565
Parents: 8948a33
Author: Sriharsha Chintalapani <ha...@hortonworks.com>
Authored: Fri Nov 20 15:00:41 2015 -0800
Committer: Sriharsha Chintalapani <ha...@hortonworks.com>
Committed: Sat Nov 21 12:23:03 2015 -0800
----------------------------------------------------------------------
.../src/jvm/storm/trident/TridentTopology.java | 17 ++++++++++++-
.../jvm/storm/trident/spout/IBatchSpout.java | 2 +-
.../spout/IOpaquePartitionedTridentSpout.java | 3 ++-
.../trident/spout/IPartitionedTridentSpout.java | 2 +-
.../storm/trident/spout/ITridentDataSource.java | 26 ++++++++++++++++++++
.../jvm/storm/trident/spout/ITridentSpout.java | 2 +-
6 files changed, 47 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/storm/blob/b15e7f9c/storm-core/src/jvm/storm/trident/TridentTopology.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/storm/trident/TridentTopology.java b/storm-core/src/jvm/storm/trident/TridentTopology.java
index 8164717..af24664 100644
--- a/storm-core/src/jvm/storm/trident/TridentTopology.java
+++ b/storm-core/src/jvm/storm/trident/TridentTopology.java
@@ -70,6 +70,7 @@ import storm.trident.spout.BatchSpoutExecutor;
import storm.trident.spout.IBatchSpout;
import storm.trident.spout.IOpaquePartitionedTridentSpout;
import storm.trident.spout.IPartitionedTridentSpout;
+import storm.trident.spout.ITridentDataSource;
import storm.trident.spout.ITridentSpout;
import storm.trident.spout.OpaquePartitionedTridentSpoutExecutor;
import storm.trident.spout.PartitionedTridentSpoutExecutor;
@@ -133,7 +134,21 @@ public class TridentTopology {
public Stream newStream(String txId, IOpaquePartitionedTridentSpout spout) {
return newStream(txId, new OpaquePartitionedTridentSpoutExecutor(spout));
}
-
+
+ public Stream newStream(String txId, ITridentDataSource dataSource) {
+ if (dataSource instanceof IBatchSpout) {
+ return newStream(txId, (IBatchSpout) dataSource);
+ } else if (dataSource instanceof ITridentSpout) {
+ return newStream(txId, (ITridentSpout) dataSource);
+ } else if (dataSource instanceof IPartitionedTridentSpout) {
+ return newStream(txId, (IPartitionedTridentSpout) dataSource);
+ } else if (dataSource instanceof IOpaquePartitionedTridentSpout) {
+ return newStream(txId, (IOpaquePartitionedTridentSpout) dataSource);
+ } else {
+ throw new UnsupportedOperationException("Unsupported stream");
+ }
+ }
+
public Stream newDRPCStream(String function) {
return newDRPCStream(new DRPCSpout(function));
}
http://git-wip-us.apache.org/repos/asf/storm/blob/b15e7f9c/storm-core/src/jvm/storm/trident/spout/IBatchSpout.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/storm/trident/spout/IBatchSpout.java b/storm-core/src/jvm/storm/trident/spout/IBatchSpout.java
index d6b0350..9e3a755 100644
--- a/storm-core/src/jvm/storm/trident/spout/IBatchSpout.java
+++ b/storm-core/src/jvm/storm/trident/spout/IBatchSpout.java
@@ -23,7 +23,7 @@ import java.io.Serializable;
import java.util.Map;
import storm.trident.operation.TridentCollector;
-public interface IBatchSpout extends Serializable {
+public interface IBatchSpout extends ITridentDataSource {
void open(Map conf, TopologyContext context);
void emitBatch(long batchId, TridentCollector collector);
void ack(long batchId);
http://git-wip-us.apache.org/repos/asf/storm/blob/b15e7f9c/storm-core/src/jvm/storm/trident/spout/IOpaquePartitionedTridentSpout.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/storm/trident/spout/IOpaquePartitionedTridentSpout.java b/storm-core/src/jvm/storm/trident/spout/IOpaquePartitionedTridentSpout.java
index c3d19ef..9a84113 100644
--- a/storm-core/src/jvm/storm/trident/spout/IOpaquePartitionedTridentSpout.java
+++ b/storm-core/src/jvm/storm/trident/spout/IOpaquePartitionedTridentSpout.java
@@ -30,7 +30,8 @@ import storm.trident.topology.TransactionAttempt;
* replay the same batch every time it emits a batch for a transaction id.
*
*/
-public interface IOpaquePartitionedTridentSpout<Partitions, Partition extends ISpoutPartition, M> extends Serializable {
+public interface IOpaquePartitionedTridentSpout<Partitions, Partition extends ISpoutPartition, M>
+ extends ITridentDataSource {
public interface Coordinator<Partitions> {
boolean isReady(long txid);
Partitions getPartitionsForBatch();
http://git-wip-us.apache.org/repos/asf/storm/blob/b15e7f9c/storm-core/src/jvm/storm/trident/spout/IPartitionedTridentSpout.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/storm/trident/spout/IPartitionedTridentSpout.java b/storm-core/src/jvm/storm/trident/spout/IPartitionedTridentSpout.java
index 56a83bb..21b1d73 100644
--- a/storm-core/src/jvm/storm/trident/spout/IPartitionedTridentSpout.java
+++ b/storm-core/src/jvm/storm/trident/spout/IPartitionedTridentSpout.java
@@ -30,7 +30,7 @@ import storm.trident.topology.TransactionAttempt;
* brokers. It automates the storing of metadata for each partition to ensure that the same batch
* is always emitted for the same transaction id. The partition metadata is stored in Zookeeper.
*/
-public interface IPartitionedTridentSpout<Partitions, Partition extends ISpoutPartition, T> extends Serializable {
+public interface IPartitionedTridentSpout<Partitions, Partition extends ISpoutPartition, T> extends ITridentDataSource {
public interface Coordinator<Partitions> {
/**
* Return the partitions currently in the source of data. The idea is
http://git-wip-us.apache.org/repos/asf/storm/blob/b15e7f9c/storm-core/src/jvm/storm/trident/spout/ITridentDataSource.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/storm/trident/spout/ITridentDataSource.java b/storm-core/src/jvm/storm/trident/spout/ITridentDataSource.java
new file mode 100644
index 0000000..aa2335b
--- /dev/null
+++ b/storm-core/src/jvm/storm/trident/spout/ITridentDataSource.java
@@ -0,0 +1,26 @@
+/*
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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 storm.trident.spout;
+
+import java.io.Serializable;
+
+/**
+ * ITridentDataSource marks all spouts that provide data into Trident.
+ */
+public interface ITridentDataSource extends Serializable {
+}
http://git-wip-us.apache.org/repos/asf/storm/blob/b15e7f9c/storm-core/src/jvm/storm/trident/spout/ITridentSpout.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/storm/trident/spout/ITridentSpout.java b/storm-core/src/jvm/storm/trident/spout/ITridentSpout.java
index 365b08a..e43d144 100644
--- a/storm-core/src/jvm/storm/trident/spout/ITridentSpout.java
+++ b/storm-core/src/jvm/storm/trident/spout/ITridentSpout.java
@@ -25,7 +25,7 @@ import java.util.Map;
import storm.trident.operation.TridentCollector;
-public interface ITridentSpout<T> extends Serializable {
+public interface ITridentSpout<T> extends ITridentDataSource {
interface BatchCoordinator<X> {
/**
* Create metadata for this particular transaction id which has never