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

Implement the BufferIntrospective operator #113

Closed
alexandru opened this Issue Jan 28, 2016 · 3 comments

Comments

Projects
None yet
2 participants
@alexandru
Copy link
Member

alexandru commented Jan 28, 2016

We need a new operator with this signature:

trait Observable[+T] {
  def bufferIntrospective(os: OverflowStrategy): Observable[Seq[T]]
}

What this will do is to buffer signals for as long as the downstream subscriber is busy. And after the downstream subscriber is available again for onNext, then it sends the buffered signals as a Seq.

Implementation sample: https://gist.github.com/dvtomas/e47bce4f8849da9721dc

@alexandru alexandru added this to the 2.0 milestone Jan 28, 2016

@dvtomas

This comment has been minimized.

Copy link

dvtomas commented Jan 28, 2016

As I've commented on gitter, perhaps these signatures would be more appropriate:

trait Observable[+T] {
  def bufferIntrospective: Observable[Seq[T]]

  def bufferIntrospective(maxSize: Int): Observable[Seq[T]]
}

They resemble the signatures of Observable.buffer, as does the principle of operation

@dvtomas

This comment has been minimized.

Copy link

dvtomas commented Feb 1, 2016

I've updated bufferIntrospective implementation in the gist, I believe it is correct now. I also have some (two :) unit tests, but it is difficult to present them here as they use some custom helpers, and I also use Li Haoyi's µTest for testing. If there's interest, though, I can try to port them somehow..

Anyway, I now have in mind an even more general "introspective" operator, that bufferIntrospective could be implemented in terms of, but I need to think about it more.

alexandru added a commit that referenced this issue Mar 28, 2016

@alexandru

This comment has been minimized.

Copy link
Member Author

alexandru commented Jun 29, 2016

This is already on master, closing.

@alexandru alexandru closed this Jun 29, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.