public static GlobalStreamId getGlobalStreamId(String streamId, String componentId) { if (componentId == null) { return new GlobalStreamId(streamId, DEFAULT_STREAM_ID); } return new GlobalStreamId(streamId, componentId); }
private String getStreamId(GlobalStreamId globalStreamId) { if (globalStreamId.get_componentId().startsWith("spout")) { return globalStreamId.get_componentId() + globalStreamId.get_streamId(); } return globalStreamId.get_streamId(); }
@Override public boolean equals(java.lang.Object that) { if (that == null) return false; if (that instanceof GlobalStreamId) return this.equals((GlobalStreamId)that); return false; }
/** * Performs a deep copy on <i>other</i>. */ public GlobalStreamId(GlobalStreamId other) { if (other.is_set_componentId()) { this.componentId = other.componentId; } if (other.is_set_streamId()) { this.streamId = other.streamId; } }
public void validate() throws org.apache.storm.thrift.TException { // check for required fields if (!is_set_componentId()) { throw new org.apache.storm.thrift.protocol.TProtocolException("Required field 'componentId' is unset! Struct:" + toString()); } if (!is_set_streamId()) { throw new org.apache.storm.thrift.protocol.TProtocolException("Required field 'streamId' is unset! Struct:" + toString()); } // check for sub-struct validity }
@Test public void testDeserialize_readingFromGzip() throws Exception { GlobalStreamId id = new GlobalStreamId("first", "second"); byte[] serialized = new GzipThriftSerializationDelegate().serialize(id); GlobalStreamId id2 = testDelegate.deserialize(serialized, GlobalStreamId.class); assertEquals(id2.get_componentId(), id.get_componentId()); assertEquals(id2.get_streamId(), id.get_streamId()); }
Map<GlobalStreamId, String> fleshOutStreamBatchIds(boolean includeCommitStream) { Map<GlobalStreamId, String> ret = new HashMap<>(batchIds); Set<String> allBatches = new HashSet<>(batchIds.values()); for (String b : allBatches) { ret.put(new GlobalStreamId(masterCoordinator(b), MasterBatchCoordinator.BATCH_STREAM_ID), b); if (includeCommitStream) { ret.put(new GlobalStreamId(masterCoordinator(b), MasterBatchCoordinator.COMMIT_STREAM_ID), b); } // DO NOT include the success stream as part of the batch. it should not trigger coordination tuples, // and is just a metadata tuple to assist in cleanup, should not trigger batch tracking } for (String id : spouts.keySet()) { TransactionalSpoutComponent c = spouts.get(id); if (c.batchGroupId != null) { ret.put(new GlobalStreamId(spoutCoordinator(id), MasterBatchCoordinator.BATCH_STREAM_ID), c.batchGroupId); } } //this takes care of setting up coord streams for spouts and bolts for (GlobalStreamId s : batchIds.keySet()) { String b = batchIds.get(s); ret.put(new GlobalStreamId(s.get_componentId(), TridentBoltExecutor.COORD_STREAM(b)), b); } return ret; }
@Override public String getComponent() { return stream.get_componentId(); } });
public OutputStream remap(String origId, Map<GlobalStreamId, GlobalStreamId> remappedStreams) { GlobalStreamId remapped = remappedStreams.get(new GlobalStreamId(origId, id)); return new OutputStream(remapped.get_streamId(), rate, areKeysSkewed); }
@Override public String getStream() { return stream.get_streamId(); } });
for (int _i39 = 0; _i39 < _map36.size; ++_i39) _key37 = new GlobalStreamId(); _key37.read(iprot); _val38 = new Grouping(); _val38.read(iprot);
@Override public int hashCode() { int result = streamId != null ? streamId.hashCode() : 0; result = 31 * result + sourceTask; return result; }
@Test public void testDeserialize_readingFromGzipBridge() throws Exception { GlobalStreamId id = new GlobalStreamId("first", "second"); byte[] serialized = new GzipBridgeThriftSerializationDelegate().serialize(id); GlobalStreamId id2 = testDelegate.deserialize(serialized, GlobalStreamId.class); assertEquals(id2.get_componentId(), id.get_componentId()); assertEquals(id2.get_streamId(), id.get_streamId()); }
/** * For bolts that has incoming streams from spouts (the root bolts), add checkpoint stream from checkpoint spout to its input. For other * bolts, add checkpoint stream from the previous bolt to its input. */ private void addCheckPointInputs(ComponentCommon component) { Set<GlobalStreamId> checkPointInputs = new HashSet<>(); for (GlobalStreamId inputStream : component.get_inputs().keySet()) { String sourceId = inputStream.get_componentId(); if (_spouts.containsKey(sourceId)) { checkPointInputs.add(new GlobalStreamId(CHECKPOINT_COMPONENT_ID, CHECKPOINT_STREAM_ID)); } else { checkPointInputs.add(new GlobalStreamId(sourceId, CHECKPOINT_STREAM_ID)); } } for (GlobalStreamId streamId : checkPointInputs) { component.put_to_inputs(streamId, Grouping.all(new NullStruct())); } }
@Override public String getComponent() { return stream.get_componentId(); }
private Set<GlobalStreamId> getComponentStreams(TopologyContext context) { Set<GlobalStreamId> streams = new HashSet<>(); for (GlobalStreamId streamId : context.getThisSources().keySet()) { if (!streamId.get_streamId().equals(CheckpointSpout.CHECKPOINT_STREAM_ID)) { streams.add(streamId); } } return streams; }
@Override public int hashCode() { int hashCode = 1; hashCode = hashCode * 8191 + ((is_set_componentId()) ? 131071 : 524287); if (is_set_componentId()) hashCode = hashCode * 8191 + componentId.hashCode(); hashCode = hashCode * 8191 + ((is_set_streamId()) ? 131071 : 524287); if (is_set_streamId()) hashCode = hashCode * 8191 + streamId.hashCode(); return hashCode; }
public void validate() throws org.apache.thrift.TException { // check for required fields if (!is_set_componentId()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'componentId' is unset! Struct:" + toString()); } if (!is_set_streamId()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'streamId' is unset! Struct:" + toString()); } // check for sub-struct validity }
@Override public int hashCode() { int result = streamId != null ? streamId.hashCode() : 0; result = 31 * result + sourceTask; return result; }
public java.lang.Object getFieldValue(_Fields field) { switch (field) { case COMPONENT_ID: return get_componentId(); case STREAM_ID: return get_streamId(); } throw new java.lang.IllegalStateException(); }