-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat(exex): subscribe to notifications explicitly #10573
Conversation
c4d7798
to
eae2985
Compare
379ca8f
to
467456b
Compare
467456b
to
aff910e
Compare
6e69df2
to
342b15f
Compare
…tifications-subscribe
crates/exex/exex/src/manager.rs
Outdated
|
||
/// Subscribe to notifications. | ||
pub fn subscribe(&mut self) -> ExExNotifications<'_> { | ||
ExExNotifications::Left(ExExNotificationsWithoutHead(&mut self.notifications)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we wrapping this here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mpsc::Receiver
doesn't implement Stream
by default. https://docs.rs/tokio-stream/0.1.15/tokio_stream/wrappers/struct.ReceiverStream.html exists for this, but I didn't want to import a new dep just for that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using either here is a bit weird, I'd prefer a custom type over this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still have some questions about the borrow
for backfill, does the user need to provide the components with the head?
crates/exex/exex/src/manager.rs
Outdated
|
||
/// Subscribe to notifications. | ||
pub fn subscribe(&mut self) -> ExExNotifications<'_> { | ||
ExExNotifications::Left(ExExNotificationsWithoutHead(&mut self.notifications)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using either here is a bit weird, I'd prefer a custom type over this
no, I don't think so. Components are the same for all ExExes, so we should just pass them to the |
why does it need that? |
942b1da
to
5d0385a
Compare
This reverts commit e3ddac4.
…tifications-subscribe
ed5c1a8
to
e6d1d4c
Compare
e6d1d4c
to
d357e2d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool
c25d0dc
to
291929c
Compare
Towards #10571. Implements a new way to subscribe to notifications.
This is not a breaking change, so it will not require any changes to existing ExExes, but the use of
ExExNotifications::recv()
is discouraged nowreth/crates/exex/exex/src/manager.rs
Lines 176 to 179 in d357e2d
Later, when we add an ability to subscribe with the given head, it will not be a breaking change too and users will just need to do
ctx.notifications.with_head(head)
instead of usingctx.notifications
directly.The functionality of
ExExNotificationsWithHead
does not include the backfill logic yet.