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

Hide subjects, provide new MulticastStrategy type #99

Closed
alexandru opened this Issue Dec 29, 2015 · 2 comments

Comments

Projects
None yet
1 participant
@alexandru
Copy link
Member

commented Dec 29, 2015

We've got 4 subject types:

  • PublishSubject
  • BehaviorSubject
  • AsyncSubject
  • ReplaySubject

In practice there's little need for custom Subject implementations. This means that users should be encouraged to work with a new type like ...

sealed trait MulticastStrategy[+T]

object MulticastStrategy {
  case object Publish extends MulticastStrategy[Nothing]
  case class Behavior[+T](initial: T) extends MulticastStrategy[T]
  case object ReplayAll extends MulticastStrategy[Nothing]
  case object ReplyLast(bufferSize: Int) MulticastStrategy[Nothing]
  case object Async extends MulticastStrategy[Nothing]
}

We then should have an Observable.multicast builder that returns an in/out pair like this:

val (in: SyncObserver[A], out: Observable[A]) = 
  Observable.multicast[A](MulticastStrategy.publish, OverflowStrategy.Unbounded)

This will make it safer to work with multicast observables by not handling subject instances directly and by separating the input from the output, discouraging the unwanted leaks of subject references.

@alexandru alexandru added this to the 2.0 milestone Dec 29, 2015

@alexandru alexandru changed the title Hide subjects, provide new BroadcastStrategy type Hide subjects, provide new MulticastStrategy type Dec 29, 2015

alexandru added a commit that referenced this issue Feb 3, 2016

alexandru added a commit that referenced this issue Feb 3, 2016

alexandru added a commit that referenced this issue Feb 3, 2016

@alexandru

This comment has been minimized.

Copy link
Member Author

commented Mar 2, 2016

Not done. We now have a Pipe that is more useful than this.

@alexandru alexandru closed this Mar 2, 2016

@alexandru alexandru removed this from the 2.0 milestone Mar 2, 2016

@alexandru alexandru added the wontfix label Mar 2, 2016

@alexandru alexandru removed the wontfix label Mar 21, 2016

@alexandru alexandru added this to the 2.0 milestone Mar 21, 2016

@alexandru alexandru reopened this Mar 21, 2016

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

@alexandru

This comment has been minimized.

Copy link
Member Author

commented Apr 8, 2016

Done.

@alexandru alexandru closed this Apr 8, 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.