-
Notifications
You must be signed in to change notification settings - Fork 168
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
[O selection] server: Use BroadcastSessionsSelector in BroadcastSessionsManager #1241
Conversation
c74d238
to
0cf12f6
Compare
Ready for full review. |
This overall looks good to me. Do you think it's worth the engineering effort to add unit tests for |
I'm ok with not adding explicit unit tests for |
This looks pretty good. On a somewhat related note re: code organization, how feasible would it be to move the |
Do you mean Moving
I'm ok with keeping everything in |
Ah yep, that.
The only thing I really wish we had was a way to indicate that a struct such as
Yeah, that's fine. Just want to keep that possibility in mind the next time someone complains about the length / scope of the files in I think this also exhibits part of the tension around code placement and package structure - which is pretty arbitrary once you get down to it. Put everything in a single file! (Kidding but only a little bit. Personally, I don't really have an issue with files that are thousands of lines long.) Anyway all that's getting off topic for this PR. LGTM! |
The refactored BroadcastSessionsManager uses LIFOSelector which implements the BroadcastSessionsSelector interface.
1dbb115
to
5e86bc6
Compare
What does this pull request do? Explain your changes. (required)
This PR moves the current LIFO O selection logic from
BroadcastSessionsManager
toLIFOSelector
which implements theBroadcastSessionsSelector
interface. The goals of this refactor are:BroadcastSessionsManager
in follow on PRs. New selection logic can be encapsulated in a new type that implements theBroadcastSessionsSelector
interfaceLIFOSelector
to serve as an example of an alternate selection strategy once the new selection strategy is implemented in follow on PRsSpecific updates (required)
BroadcastSessionsManager
to accept theBroadcastSessionsSelector
interface as a dependencyLIFOSelector
which implementsBroadcastSessionsSelector
Note that
LIFOSelector
is not concurrency safe. The caller ofLIFOSelector
should implement locking i.e.BroadcastSessionsManager
.The
BroadcastSessionsSelector
API does not contain a method for removing sessions. The caller of the API should keep track of which sessions still exist. A session returned fromSelect()
that no longer exists should be discarded andSelect()
should be called again. This design choice matches the existing design inBroadcastSessionsManager
wheresessMap
is used to keep track of existing sessions and whenever a non-existent session is returned we re-select another session.How did you test each of these updates (required)
Updated unit tests.
Does this pull request close any open issues?
Fixes #1228
Checklist:
./test.sh
pass