Add shared stream interfaces#1449
Merged
Merged
Conversation
Signed-off-by: Matei David <matei.david.35@gmail.com>
Signed-off-by: Matei David <matei.david.35@gmail.com>
Signed-off-by: Matei David <matei.david.35@gmail.com>
Signed-off-by: Matei David <matei.david.35@gmail.com>
Signed-off-by: Matei David <matei.david.35@gmail.com>
Signed-off-by: Matei David <matei.david.35@gmail.com>
Signed-off-by: Matei David <matei.david.35@gmail.com>
Signed-off-by: Matei David <matei.david.35@gmail.com>
Signed-off-by: Matei David <matei.david.35@gmail.com>
Signed-off-by: Matei David <matei.david.35@gmail.com>
Signed-off-by: Matei David <matei.david.35@gmail.com>
Signed-off-by: Matei David <matei.david.35@gmail.com>
Signed-off-by: Matei David <matei.david.35@gmail.com>
Signed-off-by: Matei David <matei.david.35@gmail.com>
Signed-off-by: Matei David <matei.david.35@gmail.com>
Signed-off-by: Matei David <matei.david.35@gmail.com>
Signed-off-by: Matei David <matei.david.35@gmail.com>
…t-impl Signed-off-by: Matei David <matei.david.35@gmail.com>
Signed-off-by: Matei David <matei.david.35@gmail.com>
Signed-off-by: Matei David <matei.david.35@gmail.com>
Signed-off-by: Matei David <matei.david.35@gmail.com>
Signed-off-by: Matei David <matei.david.35@gmail.com>
Signed-off-by: Matei David <matei.david.35@gmail.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1449 +/- ##
=======================================
+ Coverage 74.3% 74.7% +0.5%
=======================================
Files 78 79 +1
Lines 6689 6868 +179
=======================================
+ Hits 4964 5125 +161
- Misses 1725 1743 +18
|
clux
reviewed
Mar 30, 2024
Member
clux
left a comment
There was a problem hiding this comment.
This is huge! Amazing work. I've left some initial thoughts on the public interface and some of the internals.
clux
reviewed
Apr 3, 2024
Co-authored-by: Eirik A <sszynrae@gmail.com> Signed-off-by: Matei David <matei.david.35@gmail.com>
Signed-off-by: Matei David <matei.david.35@gmail.com>
clux
reviewed
Apr 11, 2024
clux
reviewed
Apr 11, 2024
clux
reviewed
Apr 11, 2024
Signed-off-by: Matei David <matei.david.35@gmail.com>
Signed-off-by: Matei David <matei.david.35@gmail.com>
Signed-off-by: Matei David <matei.david.35@gmail.com>
Signed-off-by: Matei David <matei.david.35@gmail.com>
clux
approved these changes
Apr 17, 2024
Member
clux
left a comment
There was a problem hiding this comment.
looks great. nothing major stands out so 👍 from me
some minor nits, feel free to fix/ignore
Signed-off-by: Matei David <matei.david.35@gmail.com>
clux
approved these changes
Apr 17, 2024
This was
linked to
issues
Apr 17, 2024
This was referenced Apr 17, 2024
7 tasks
clux
added a commit
that referenced
this pull request
Apr 18, 2024
This was never properly usable without further integration, and as such was never stabilised. It is replaced via #1449 Signed-off-by: clux <sszynrae@gmail.com>
3 tasks
clux
added a commit
that referenced
this pull request
May 1, 2024
* Remove abandoned `StreamSubscribe` implementation This was never properly usable without further integration, and as such was never stabilised. It is replaced via #1449 Signed-off-by: clux <sszynrae@gmail.com> * forgot two imports Signed-off-by: clux <sszynrae@gmail.com> --------- Signed-off-by: clux <sszynrae@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Stream sharing has been missing from the library for some time now. We've had a few attempts at making it happen, e.g. new controller interfaces (such as
Controller::for_stream) and a stream subscriber adapter. #1189 describes the original issue we sought to solve before shipping shared streams: getting all of the interfaces to play well together.This change is a departure from the original issue described in #1189. After some exploration, it became a bit clearer that the stream subscriber interface may not be the best primitive to use:
This PR (and most of the exploration done as part of it) aims to address these two issues by changing and adding new interfaces.
Solution
Broadly speaking:
As a general rule of thumb, the solution here should be backwards compatible and avoid breaking current functionality. For now, it made more sense to introduce more duplication to allow for more flexibility in the future to change the current implementation (or in other words this should be marked as experimental).
More focused:
ObjectRef) on the broadcast channel.ReflectHandlecontains a store reader and a broadcast receiver. It implementsStreamand yields K-typed objects. The stream implementation reads a reference from the broadcast channel and retrieves the object from the store.Contract:
new_with_dispatch, otherwise the broadcast channel will never be used.reflect(). More subscribers can be created after by cloning the initial handle.Controller::for_shared_stream).Potential future work:
Controller::for_owned_shared, naming TBD ofc).dispatch_eventwithapply_watcher_eventFeedback welcome! Especially if we can simplify the current implementation. Some things may be out of place for now. I think in the spirit of keeping this as flexible as possible, my recommendation would be to duplicate code until we can get this in the hands of people that have more niche use cases or that can test it out at scale.
There's a big commit history for people curious on how this evolved over time. Ultimately settled on some approaches suggested in #1426.