Skip to content
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

Add NotificationQueue for priority notifications #4

Merged
merged 24 commits into from
Apr 30, 2024

Conversation

mkatychev
Copy link
Contributor

@mkatychev mkatychev commented Apr 26, 2024

NotificationManager now features a NotificationQueue struct for priority notifications:

rex-sm/src/notification.rs

Lines 92 to 110 in 58a1c8a

#[derive(Default, Clone, Debug)]
pub struct NotificationQueue<M: RexMessage>(pub(crate) Arc<StreamableDeque<Notification<M>>>);
impl<M: RexMessage> NotificationQueue<M> {
pub fn new() -> Self {
Self(Arc::new(StreamableDeque::new()))
}
pub fn send(&self, notif: Notification<M>) {
self.0.push_back(notif)
}
pub fn priority_send(&self, notif: Notification<M>) {
self.0.push_front(notif)
}
pub fn stream(&self) -> StreamReceiver<Notification<M>> {
self.0.stream()
}
}

  • Moved RexBuilder into separate module
  • Added RexBuilder::with_ingress_adapter method:

    rex-sm/src/builder.rs

    Lines 227 to 251 in cf3291d

    pub fn with_ingress_adapter(
    mut self,
    state_routers: Vec<BoxedStateRouter<K, In>>,
    ingress_topic: <K::Message as RexMessage>::Topic,
    ) -> Self {
    assert!(!state_routers.is_empty());
    let (tx, rx) = self
    .ingress_channel
    .take()
    .expect("ingress_channel uninitialized");
    let outbound_tx = self
    .outbound_tx
    .clone()
    .expect("builder outbound_tx uninitialized");
    let ingress_adapter = IngressAdapter {
    signal_queue: self.signal_queue.clone(),
    outbound_tx,
    router: PacketRouter::new(state_routers),
    inbound_tx: tx,
    inbound_rx: Some(rx),
    topic: ingress_topic,
    };
    self.with_np(ingress_adapter)
    }

@mergify mergify bot added the feature label Apr 26, 2024
@mkatychev mkatychev changed the title Addid NotificationQueue for priority notifications Add NotificationQueue for priority notifications Apr 28, 2024
@mkatychev mkatychev marked this pull request as ready for review April 30, 2024 03:34
@mkatychev mkatychev requested a review from a team April 30, 2024 06:24
@mergify mergify bot merged commit 8b290b7 into main Apr 30, 2024
3 of 4 checks passed
@mergify mergify bot deleted the feat/notification-queue branch April 30, 2024 15:02
Copy link

mergify bot commented Apr 30, 2024

[✅] @mkatychev: Add NotificationQueue for priority notifications has been merged successfully.

@mergify mergify bot removed the automerge label Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants