Add event catch-up for glob subscriptions
This change modifies the get_events_since implementation to handle the
case of "*" management types to return all the events.
@@ -1562,6 +1562,7 @@ impl AdminServiceShared {
}
}
+ #[cfg(not(feature = "admin-service-event-subscriber-glob"))]
pub fn get_events_since(
&self,
since_event_id: &i64,
@@ -1579,6 +1580,29 @@ impl AdminServiceShared {
})
}
+ #[cfg(feature = "admin-service-event-subscriber-glob")]
+ pub fn get_events_since(
+ &self,
+ since_event_id: &i64,
+ circuit_management_type: &str,
+ ) -> Result<Events, AdminSharedError> {
+ let events = if circuit_management_type == "*" {
+ self.event_store
+ .list_events_since(*since_event_id)
+ .map_err(|err| AdminSharedError::UnableToAddSubscriber(err.to_string()))?
+ } else {
+ self.event_store
+ .list_events_by_management_type_since(
+ circuit_management_type.to_string(),
+ *since_event_id,
+ )
+ .map_err(|err| AdminSharedError::UnableToAddSubscriber(err.to_string()))?
+ };
+ Ok(Events {
+ inner: Box::new(events),
+ })
+ }
+
pub fn add_subscriber(
&mut self,
circuit_management_type: String,
