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

2.x: New base interface types #4044

Closed
akarnokd opened this issue Jun 20, 2016 · 15 comments
Closed

2.x: New base interface types #4044

akarnokd opened this issue Jun 20, 2016 · 15 comments
Milestone

Comments

@akarnokd
Copy link
Member

As part of the 2.x design, new base interface types have been recently merged & applied. The aim is to match the style of the Reactive-Streams base types + their fluent base class:

Flowable -> Publisher -> Subscriber
Observable -> ObservableConsumable -> Observer
Single -> SingleConsumable -> SingleSubscriber
Completable -> CompletableConsumable -> CompletableSubscriber

They feel odd to me too so any idea is welcome.

@JakeWharton
Copy link
Contributor

Just to be clear before I start thinking about this more, Publisher and Subscriber are the only RS types here, right? And Single and Completable are always backpressure-aware types?

@akarnokd akarnokd added this to the 2.0 RC 1 milestone Jun 20, 2016
@akarnokd
Copy link
Member Author

Publisher and Subscriber are the only RS types

Yes.

Single and Completable are always backpressure-aware types?

The other base types (including Observable) don't have a notion for backpressure.

@artem-zinnatullin
Copy link
Contributor

Can we please keep names for Observable, Single and Completable since they're not part of RS? They're short and well known.

I'd just rename Observer to ObservableSubscriber to have same pattern as SingleSubscriber and CompletableSubscriber and not interfere with Publisher -> Subscriber.

@JakeWharton
Copy link
Contributor

JakeWharton commented Jun 20, 2016

I wouldn't mind renaming Observable since it's a description of the pattern to which all these types conform. It's the least descriptive of the bunch, and you wouldn't chose it today given the others.

I used to like Flowable, and I still do, but now that we have a non-BP vs. BP distinction perhaps we should consider making BP-aware variants of all 3 types and using Flowable as an adjective instead of a noun? The problem is that gets verbose.

@akarnokd
Copy link
Member Author

Single and Completable don't need backpressure because they emit 1 or 0 items respectively.

The non-backpressured Observable was requested to allow pure GUI event handling where the sources are hot and can't be backpressured.

@JakeWharton
Copy link
Contributor

Hmm what about the request(0) case though? Where work isn't triggered upon subscription but deferred until explicitly requested.

@JakeWharton
Copy link
Contributor

Sorry I mean the case where an operation cannot respect request(0). I'm struggling to come up with an example, but I know I've ran into potential cases before but I never wrote them down (because we never had Flowable either).

@akarnokd
Copy link
Member Author

The current rule of thumb is that if an operator can't respect the request amount, it will signal a MissingBackpressureException instead of overflowing the downstream. This behavior still requires request tracking. The reason for signalling is due to the confusion about the situation in 1.x where exception is signalled in the operator that suffered the buffer overflow attempt and no indication whose fault it was really.

@JakeWharton
Copy link
Contributor

There's also the Subject and FlowProcessor types in the mix here.

@JakeWharton
Copy link
Contributor

I made a chart of the current naming:

screen shot 2016-08-07 at 2 11 01 am

And here's my proposal for normalization:

screen shot 2016-08-07 at 2 22 10 am

The changes from current master are highlighted.

@akarnokd
Copy link
Member Author

akarnokd commented Aug 7, 2016

👍

@vanniktech
Copy link
Collaborator

I'll give the Single changes a try.

@vanniktech
Copy link
Collaborator

Will continue with Completable once the other 2 PRs are merged to avoid merge conflicts.

@vanniktech
Copy link
Collaborator

The proposed new names have been applied and I guess this issue can be closed then if there is no further input.

@akarnokd
Copy link
Member Author

Renames and refactorings happened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants