{"action":"created","comment":{"url":"https://api.github.com/repos/apache/samza/pulls/comments/89948229","pull_request_review_id":10475377,"id":89948229,"diff_hunk":"@@ -16,173 +16,109 @@\n  * specific language governing permissions and limitations\n  * under the License.\n  */\n-\n package org.apache.samza.operators;\n \n import org.apache.samza.annotation.InterfaceStability;\n import org.apache.samza.operators.data.Message;\n-import org.apache.samza.operators.internal.Operators;\n-import org.apache.samza.operators.internal.Operators.Operator;\n-import org.apache.samza.operators.internal.WindowOutput;\n-import org.apache.samza.task.MessageCollector;\n-import org.apache.samza.task.TaskCoordinator;\n+import org.apache.samza.operators.functions.FilterFunction;\n+import org.apache.samza.operators.functions.FlatMapFunction;\n+import org.apache.samza.operators.functions.JoinFunction;\n+import org.apache.samza.operators.functions.MapFunction;\n+import org.apache.samza.operators.functions.SinkFunction;\n+import org.apache.samza.operators.windows.Window;\n+import org.apache.samza.operators.windows.WindowOutput;\n+import org.apache.samza.operators.windows.WindowState;\n \n-import java.util.ArrayList;\n import java.util.Collection;\n-import java.util.Collections;\n-import java.util.HashSet;\n-import java.util.Set;\n-import java.util.function.BiFunction;\n-import java.util.function.Function;\n \n \n /**\n- * This class defines either the input or output streams to/from the operators. Users use the API methods defined here to\n- * directly program the stream processing stages that processes a stream and generate another one.\n- *\n- * @param <M>  Type of message in this stream\n+ * Represents a stream of values of type {@link Message}. A {@link MessageStream} can be transformed into another\n+ * {@link MessageStream} by applying the transforms in this API.\n+ * @param <M>  type of {@link Message}s in this stream\n  */\n @InterfaceStability.Unstable\n-public class MessageStream<M extends Message> {\n-\n-  private final Set<Operator> subscribers = new HashSet<>();\n-\n-  /**\n-   * Helper method to get the corresponding list of subscribers to a specific {@link MessageStream}.\n-   *\n-   * NOTE: This is purely an internal API and should not be used directly by programmers.\n-   *\n-   * @return A unmodifiable set containing all {@link Operator}s that subscribe to this {@link MessageStream} object\n-   */\n-  public Collection<Operator> getSubscribers() {\n-    return Collections.unmodifiableSet(this.subscribers);\n-  }\n-\n-  /**\n-   * Public API methods start here\n-   */\n+public interface MessageStream<M extends Message> {\n \n   /**\n-   * Defines a function API that takes three input parameters w/ types {@code A}, {@code B}, and {@code C} and w/o a return value\n+   * Applies the 1:1 {@link MapFunction} to this {@link MessageStream} and returns the resulting {@link MessageStream}.","path":"samza-api/src/main/java/org/apache/samza/operators/MessageStream.java","position":64,"original_position":64,"commit_id":"25f2f54d8ce9a418629c71c872eddf50b01c5a03","original_commit_id":"25f2f54d8ce9a418629c71c872eddf50b01c5a03","user":{"login":"prateekm","id":1085859,"avatar_url":"https://avatars.githubusercontent.com/u/1085859?v=3","gravatar_id":"","url":"https://api.github.com/users/prateekm","html_url":"https://github.com/prateekm","followers_url":"https://api.github.com/users/prateekm/followers","following_url":"https://api.github.com/users/prateekm/following{/other_user}","gists_url":"https://api.github.com/users/prateekm/gists{/gist_id}","starred_url":"https://api.github.com/users/prateekm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prateekm/subscriptions","organizations_url":"https://api.github.com/users/prateekm/orgs","repos_url":"https://api.github.com/users/prateekm/repos","events_url":"https://api.github.com/users/prateekm/events{/privacy}","received_events_url":"https://api.github.com/users/prateekm/received_events","type":"User","site_admin":false},"body":"Yeah, will make them consistent. Slightly prefer the more explicit/descriptive \"{@link Messages} in this {@link MessageStream}\". Thoughts?","created_at":"2016-11-29T06:31:34Z","updated_at":"2016-11-29T06:31:34Z","html_url":"https://github.com/apache/samza/pull/25#discussion_r89948229","pull_request_url":"https://api.github.com/repos/apache/samza/pulls/25","_links":{"self":{"href":"https://api.github.com/repos/apache/samza/pulls/comments/89948229"},"html":{"href":"https://github.com/apache/samza/pull/25#discussion_r89948229"},"pull_request":{"href":"https://api.github.com/repos/apache/samza/pulls/25"}}},"pull_request":{"url":"https://api.github.com/repos/apache/samza/pulls/25","id":95591181,"html_url":"https://github.com/apache/samza/pull/25","diff_url":"https://github.com/apache/samza/pull/25.diff","patch_url":"https://github.com/apache/samza/pull/25.patch","issue_url":"https://api.github.com/repos/apache/samza/issues/25","number":25,"state":"open","locked":false,"title":"SAMZA-1054: Refactor Operator APIs","user":{"login":"prateekm","id":1085859,"avatar_url":"https://avatars.githubusercontent.com/u/1085859?v=3","gravatar_id":"","url":"https://api.github.com/users/prateekm","html_url":"https://github.com/prateekm","followers_url":"https://api.github.com/users/prateekm/followers","following_url":"https://api.github.com/users/prateekm/following{/other_user}","gists_url":"https://api.github.com/users/prateekm/gists{/gist_id}","starred_url":"https://api.github.com/users/prateekm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prateekm/subscriptions","organizations_url":"https://api.github.com/users/prateekm/orgs","repos_url":"https://api.github.com/users/prateekm/repos","events_url":"https://api.github.com/users/prateekm/events{/privacy}","received_events_url":"https://api.github.com/users/prateekm/received_events","type":"User","site_admin":false},"body":"Some suggestions for an Operator API refactor and misc. cleanup. It does contain some implementation changes, mostly due to deleted, extracted or merged classes. (e.g. OperatorFactory + ChainedOperators == OperatorImpls).\r\n\r\nSince git marked several moved classes as (delete + new) instead, it's probably best to apply the diff locally and  browse the code in an IDE.\r\n\r\nSome of the changes, in no particular order:\r\n* Extracted XFunction interfaces into a .functions package in -api.\r\n* -api's internal.Operators is now the -operators's spec.* package. Extracted interfaces and classes. Factory methods are now in OperatorSpecs.\r\n* -api's MessageStreams is now -api's MessageStream interface and -operators's MessageStreamImpl.\r\n* -api's internal.Windows classes are now in -api's .window package. Extracted interfaces and classes, but no implementation changes.\r\n* OperatorFactory + ChainedOperators is now OperatorImpls, which is used from StreamOperatorAdaptorTask.\r\n* Added a NoOpOperatorImpl, which acts as the root node for the OperatorImpl DAG returned by OperatorImpls.\r\n* Removed usages of reactivestreams APIs since current code looks simpler without them. We can add them back when we need features like backpressure etc.\r\n* Removed the InputSystemMessage interface.\r\n* Made field names consistent (e.g Fn suffix for functions everywhere etc.).\r\n* Some method/class visibility changes due to moved classes.\r\n* General documentation changes, mostly to make public APIs clearer.\r\n\r\nThere are additional questions/tasks that we can address in future RBs:\r\n* Updating Window and Trigger APIs.\r\n* Merging samza-operator into samza-core.\r\n* Questions about Message timestamp and Offset comparison semantics.\r\n* Questions about OperatorSpec serialization (e.g. ID generation).\r\n* Questions about StateStoreImpl and StoreFunctions.","created_at":"2016-11-28T22:41:22Z","updated_at":"2016-11-29T06:31:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"55f1f8a14f48e1f81c4ef62b66c5231f39e9b175","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/samza/pulls/25/commits","review_comments_url":"https://api.github.com/repos/apache/samza/pulls/25/comments","review_comment_url":"https://api.github.com/repos/apache/samza/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/samza/issues/25/comments","statuses_url":"https://api.github.com/repos/apache/samza/statuses/25f2f54d8ce9a418629c71c872eddf50b01c5a03","head":{"label":"prateekm:master","ref":"master","sha":"25f2f54d8ce9a418629c71c872eddf50b01c5a03","user":{"login":"prateekm","id":1085859,"avatar_url":"https://avatars.githubusercontent.com/u/1085859?v=3","gravatar_id":"","url":"https://api.github.com/users/prateekm","html_url":"https://github.com/prateekm","followers_url":"https://api.github.com/users/prateekm/followers","following_url":"https://api.github.com/users/prateekm/following{/other_user}","gists_url":"https://api.github.com/users/prateekm/gists{/gist_id}","starred_url":"https://api.github.com/users/prateekm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prateekm/subscriptions","organizations_url":"https://api.github.com/users/prateekm/orgs","repos_url":"https://api.github.com/users/prateekm/repos","events_url":"https://api.github.com/users/prateekm/events{/privacy}","received_events_url":"https://api.github.com/users/prateekm/received_events","type":"User","site_admin":false},"repo":{"id":75019478,"name":"samza","full_name":"prateekm/samza","owner":{"login":"prateekm","id":1085859,"avatar_url":"https://avatars.githubusercontent.com/u/1085859?v=3","gravatar_id":"","url":"https://api.github.com/users/prateekm","html_url":"https://github.com/prateekm","followers_url":"https://api.github.com/users/prateekm/followers","following_url":"https://api.github.com/users/prateekm/following{/other_user}","gists_url":"https://api.github.com/users/prateekm/gists{/gist_id}","starred_url":"https://api.github.com/users/prateekm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prateekm/subscriptions","organizations_url":"https://api.github.com/users/prateekm/orgs","repos_url":"https://api.github.com/users/prateekm/repos","events_url":"https://api.github.com/users/prateekm/events{/privacy}","received_events_url":"https://api.github.com/users/prateekm/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/prateekm/samza","description":"Mirror of Apache Samza","fork":true,"url":"https://api.github.com/repos/prateekm/samza","forks_url":"https://api.github.com/repos/prateekm/samza/forks","keys_url":"https://api.github.com/repos/prateekm/samza/keys{/key_id}","collaborators_url":"https://api.github.com/repos/prateekm/samza/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/prateekm/samza/teams","hooks_url":"https://api.github.com/repos/prateekm/samza/hooks","issue_events_url":"https://api.github.com/repos/prateekm/samza/issues/events{/number}","events_url":"https://api.github.com/repos/prateekm/samza/events","assignees_url":"https://api.github.com/repos/prateekm/samza/assignees{/user}","branches_url":"https://api.github.com/repos/prateekm/samza/branches{/branch}","tags_url":"https://api.github.com/repos/prateekm/samza/tags","blobs_url":"https://api.github.com/repos/prateekm/samza/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/prateekm/samza/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/prateekm/samza/git/refs{/sha}","trees_url":"https://api.github.com/repos/prateekm/samza/git/trees{/sha}","statuses_url":"https://api.github.com/repos/prateekm/samza/statuses/{sha}","languages_url":"https://api.github.com/repos/prateekm/samza/languages","stargazers_url":"https://api.github.com/repos/prateekm/samza/stargazers","contributors_url":"https://api.github.com/repos/prateekm/samza/contributors","subscribers_url":"https://api.github.com/repos/prateekm/samza/subscribers","subscription_url":"https://api.github.com/repos/prateekm/samza/subscription","commits_url":"https://api.github.com/repos/prateekm/samza/commits{/sha}","git_commits_url":"https://api.github.com/repos/prateekm/samza/git/commits{/sha}","comments_url":"https://api.github.com/repos/prateekm/samza/comments{/number}","issue_comment_url":"https://api.github.com/repos/prateekm/samza/issues/comments{/number}","contents_url":"https://api.github.com/repos/prateekm/samza/contents/{+path}","compare_url":"https://api.github.com/repos/prateekm/samza/compare/{base}...{head}","merges_url":"https://api.github.com/repos/prateekm/samza/merges","archive_url":"https://api.github.com/repos/prateekm/samza/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/prateekm/samza/downloads","issues_url":"https://api.github.com/repos/prateekm/samza/issues{/number}","pulls_url":"https://api.github.com/repos/prateekm/samza/pulls{/number}","milestones_url":"https://api.github.com/repos/prateekm/samza/milestones{/number}","notifications_url":"https://api.github.com/repos/prateekm/samza/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/prateekm/samza/labels{/name}","releases_url":"https://api.github.com/repos/prateekm/samza/releases{/id}","deployments_url":"https://api.github.com/repos/prateekm/samza/deployments","created_at":"2016-11-28T22:22:29Z","updated_at":"2016-11-28T22:22:33Z","pushed_at":"2016-11-28T22:39:16Z","git_url":"git://github.com/prateekm/samza.git","ssh_url":"git@github.com:prateekm/samza.git","clone_url":"https://github.com/prateekm/samza.git","svn_url":"https://github.com/prateekm/samza","homepage":null,"size":14789,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"1e5f30f38e9d67fd73ead817bdeb5eae22da78dd","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":32199982,"name":"samza","full_name":"apache/samza","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/samza","description":"Mirror of Apache Samza","fork":false,"url":"https://api.github.com/repos/apache/samza","forks_url":"https://api.github.com/repos/apache/samza/forks","keys_url":"https://api.github.com/repos/apache/samza/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/samza/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/samza/teams","hooks_url":"https://api.github.com/repos/apache/samza/hooks","issue_events_url":"https://api.github.com/repos/apache/samza/issues/events{/number}","events_url":"https://api.github.com/repos/apache/samza/events","assignees_url":"https://api.github.com/repos/apache/samza/assignees{/user}","branches_url":"https://api.github.com/repos/apache/samza/branches{/branch}","tags_url":"https://api.github.com/repos/apache/samza/tags","blobs_url":"https://api.github.com/repos/apache/samza/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/samza/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/samza/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/samza/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/samza/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/samza/languages","stargazers_url":"https://api.github.com/repos/apache/samza/stargazers","contributors_url":"https://api.github.com/repos/apache/samza/contributors","subscribers_url":"https://api.github.com/repos/apache/samza/subscribers","subscription_url":"https://api.github.com/repos/apache/samza/subscription","commits_url":"https://api.github.com/repos/apache/samza/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/samza/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/samza/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/samza/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/samza/contents/{+path}","compare_url":"https://api.github.com/repos/apache/samza/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/samza/merges","archive_url":"https://api.github.com/repos/apache/samza/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/samza/downloads","issues_url":"https://api.github.com/repos/apache/samza/issues{/number}","pulls_url":"https://api.github.com/repos/apache/samza/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/samza/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/samza/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/samza/labels{/name}","releases_url":"https://api.github.com/repos/apache/samza/releases{/id}","deployments_url":"https://api.github.com/repos/apache/samza/deployments","created_at":"2015-03-14T07:00:05Z","updated_at":"2016-11-28T22:15:03Z","pushed_at":"2016-11-29T00:08:30Z","git_url":"git://github.com/apache/samza.git","ssh_url":"git@github.com:apache/samza.git","clone_url":"https://github.com/apache/samza.git","svn_url":"https://github.com/apache/samza","homepage":null,"size":15134,"stargazers_count":264,"watchers_count":264,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":123,"mirror_url":"git://git.apache.org/samza.git","open_issues_count":14,"forks":123,"open_issues":14,"watchers":264,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/samza/pulls/25"},"html":{"href":"https://github.com/apache/samza/pull/25"},"issue":{"href":"https://api.github.com/repos/apache/samza/issues/25"},"comments":{"href":"https://api.github.com/repos/apache/samza/issues/25/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/samza/pulls/25/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/samza/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/samza/pulls/25/commits"},"statuses":{"href":"https://api.github.com/repos/apache/samza/statuses/25f2f54d8ce9a418629c71c872eddf50b01c5a03"}}}}
{"actor":{"display_login":"prateekm"}}