Skip to content
New issue

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

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

Already on GitHub? # to your account

Track queue size of bounded queues #1468

Merged
merged 8 commits into from
Jun 3, 2019

Conversation

by-dam
Copy link

@by-dam by-dam commented May 14, 2019

tentative to address #1448

@@ -436,6 +436,36 @@ private[fs2] object PubSub {
strategy.unsubscribe(selector, state)
}

def withSize[A, S](strategy: PubSub.Strategy[A, Chunk[A], S, Int])
: PubSub.Strategy[A, Chunk[A], (S, Int), Int] =
new PubSub.Strategy[A, Chunk[A], (S, Int), Int] {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strategy that tracks the queue size along with the state S

@mpilquist
Copy link
Member

@by-dam Looks like we need similar changes in the experimental module too.

@mpilquist
Copy link
Member

@by-dam I changed the approach a bit, introducing a new SizedQueue class. Hope that's okay.

@SystemFw
Copy link
Collaborator

SystemFw commented Jun 3, 2019

I changed the approach a bit, introducing a new SizedQueue class. Hope that's okay.

Fwiw, I was also a bit unsure whether the size tracking belonged to Queue or PubSub, but couldn't really decide either way

@mpilquist
Copy link
Member

@SystemFw Yeah, when I getting this PR ready for merge, I noticed circularBuffer needed a similar treatment b/c each enqueue checked q.size, and the original strategy from this PR didn't help in that case. Are you OK with merging this new version?

@SystemFw
Copy link
Collaborator

SystemFw commented Jun 3, 2019

Yes, let's merge this :)

@by-dam
Copy link
Author

by-dam commented Jun 3, 2019

I changed the approach a bit, introducing a new SizedQueue class. Hope that's okay.

@mpilquist Sure, thanks for looking at it

@mpilquist mpilquist merged commit 1ec01ab into typelevel:series/1.0 Jun 3, 2019
@mpilquist mpilquist added this to the 1.0.5 milestone Jun 10, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants