-
Notifications
You must be signed in to change notification settings - Fork 489
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move stream publishers to connection-level context (#2452)
This is the first PR of implementation of dropping a stream's server-side counterpart when a stream on the client-side is dropped. This is all part of the activities for managing offsets per consumer on the SPU side. Currently, the lifetime of `StreamPublisher` is equal to the lifetime of Tcp connection between SPU and client. We do not clean up `StreamPublishers` until the connection is dropped. Therefore, there is no need to keep them inside `GlobalContext` and have it multi-threaded, because it is always touched by only one thread (the one that handles connection). This PR doesn't add or remove any functional behavior. The `StreamPublishers` will be dropped after disconnect as it does now. The actual drop mechanism will go in another PR.
- Loading branch information
Alexander Galibey
committed
Jul 1, 2022
1 parent
8935fe7
commit 44e2f04
Showing
6 changed files
with
55 additions
and
54 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
use crate::services::public::StreamPublishers; | ||
|
||
#[derive(Debug)] | ||
pub(crate) struct ConnectionContext { | ||
stream_publishers: StreamPublishers, | ||
} | ||
|
||
impl ConnectionContext { | ||
pub(crate) fn new() -> Self { | ||
Self { | ||
stream_publishers: StreamPublishers::new(), | ||
} | ||
} | ||
|
||
pub(crate) fn stream_publishers(&self) -> &StreamPublishers { | ||
&self.stream_publishers | ||
} | ||
|
||
pub(crate) fn stream_publishers_mut(&mut self) -> &mut StreamPublishers { | ||
&mut self.stream_publishers | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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