Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Stage types #139

Open
akarnokd opened this issue Feb 25, 2020 · 1 comment
Open

Missing Stage types #139

akarnokd opened this issue Feb 25, 2020 · 1 comment
Milestone

Comments

@akarnokd
Copy link

Looks like some of the ReactiveStreamsFactory based sources do not have a Stage equivalent:

  • empty -> could be mimicked with Stage.Of returning an empty collection, but less efficient
  • of(T) -> could be mimicked with Stage.Of returning an empty collection, but less efficient
  • of(T...) -> could be mimicked with Stage.Of returning an empty collection, but less efficient
  • iterate -> could be mimicked with Stage.Of, but less efficient
  • generate -> could be mimicked with Stage.Of, but less efficient
  • forEach
  • ignore -> there is a Stage.Cancel though
  • reduce(T, BinaryOperator) -> there is FindFirst though
  • reduce(BinaryOperator)
  • collect(Supplier, BiConsumer) -> there is Collect with java.util.stream.Collector though
  • toList -> could be mimicked via Collect, but it is inefficient in
  • to(SubscriberBuilder) -> is this Stage.SubscriberStage too, ignoring the CompletionStage?
  • via(ProcessorBuilder) -> is this Stage.ProcessorStage too?
@Azquelt
Copy link
Member

Azquelt commented Jul 6, 2020

To fill out the rest of your list with what the core implementation does:

  • forEach -> uses Stage.Collect
  • ignore -> same as forEach but with an empty action
  • reduce -> implements the reduction operation as a Collector and uses Stage.Collect
  • to(SubscriberBuilder) / via(ProcessorBuilder) -> these don't have a corresponding stage. Instead the stages from the SubscriberBuilder or ProcessorBuilder are added to the graph. The core implementation actually creates an internal nested stage which is removed when toGraph() is called.

You're correct that there isn't a 1:1 mapping between builder methods and stages. I'm not sure why that decision was taken.

@Emily-Jiang Emily-Jiang added this to the Future milestone Jul 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants