|
| 1 | +/** |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | + * or more contributor license agreements. See the NOTICE file |
| 4 | + * distributed with this work for additional information |
| 5 | + * regarding copyright ownership. The ASF licenses this file |
| 6 | + * to you under the Apache License, Version 2.0 (the |
| 7 | + * "License"); you may not use this file except in compliance |
| 8 | + * with the License. You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, |
| 13 | + * software distributed under the License is distributed on an |
| 14 | + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | + * KIND, either express or implied. See the License for the |
| 16 | + * specific language governing permissions and limitations |
| 17 | + * under the License. |
| 18 | + */ |
| 19 | + |
| 20 | +package org.apache.heron.streamlet; |
| 21 | + |
| 22 | +/** |
| 23 | + * A Streamlet is a (potentially unbounded) ordered collection of tuples. |
| 24 | + * The StreamletBase class contains basic information of a Streamlet |
| 25 | + * such as name and partition count without the connection functions |
| 26 | + * such as map() and filter(). |
| 27 | + */ |
| 28 | +public interface StreamletBase<R> { |
| 29 | + |
| 30 | + /** |
| 31 | + * Sets the name of the BaseStreamlet. |
| 32 | + * @param sName The name given by the user for this BaseStreamlet |
| 33 | + * @return Returns back the Streamlet with changed name |
| 34 | + */ |
| 35 | + StreamletBase<R> setName(String sName); |
| 36 | + |
| 37 | + /** |
| 38 | + * Gets the name of the Streamlet. |
| 39 | + * @return Returns the name of the Streamlet |
| 40 | + */ |
| 41 | + String getName(); |
| 42 | + |
| 43 | + /** |
| 44 | + * Sets the number of partitions of the streamlet |
| 45 | + * @param numPartitions The user assigned number of partitions |
| 46 | + * @return Returns back the Streamlet with changed number of partitions |
| 47 | + */ |
| 48 | + StreamletBase<R> setNumPartitions(int numPartitions); |
| 49 | + |
| 50 | + /** |
| 51 | + * Gets the number of partitions of this Streamlet. |
| 52 | + * @return the number of partitions of this Streamlet |
| 53 | + */ |
| 54 | + int getNumPartitions(); |
| 55 | + |
| 56 | + // This is the main interface that every Streamlet implementation should implement |
| 57 | + // The main tasks are generally to make sure that appropriate names/partitions are |
| 58 | + // computed and add a spout/bolt to the TopologyBuilder |
| 59 | + // void build(TopologyBuilder bldr, Set<String> stageNames); |
| 60 | +} |
0 commit comments