New (unstable) notification on failed probe
- Id
- 4cf331c451848b1545f70a1937f6f7bf76ae5c3b
- Author
- Caio
- Commit time
- 2024-10-04T11:05:25+02:00
Modified src/lib.rs
}
if let Some(failed) = self.probe.take_failed() {
+ #[cfg(feature = "unstable-notifications")]
+ runtime.notify(Notification::ProbeFailed(
+ self.probe.probe_number(),
+ failed.id(),
+ ));
+
// Applying here can fail if:
//
// 1. The member increased its incarnation since the probe started
Modified src/runtime.rs
use bytes::{Bytes, BytesMut};
#[cfg(feature = "unstable-notifications")]
-use crate::Header;
+use crate::{Header, ProbeNumber};
use crate::{Identity, Incarnation};
/// A Runtime is Foca's gateway to the real world: here is where
///
/// See [`Header`]
DataSent(&'a Header<T>),
+
+ #[cfg(feature = "unstable-notifications")]
+ /// Foca has probed a member and didn't receive a timely reply
+ /// from it nor from any other member asked to indirectly ping it
+ ///
+ /// See [`crate::Message`]
+ ProbeFailed(ProbeNumber, &'a T),
}
impl<'a, T> Notification<'a, T>
Notification::DataReceived(h) => OwnedNotification::DataReceived(h.clone()),
#[cfg(feature = "unstable-notifications")]
Notification::DataSent(h) => OwnedNotification::DataSent(h.clone()),
+ #[cfg(feature = "unstable-notifications")]
+ Notification::ProbeFailed(n, m) => OwnedNotification::ProbeFailed(n, m.clone()),
}
}
}
#[cfg(feature = "unstable-notifications")]
/// See [`Notification::DataSent`]
DataSent(Header<T>),
+
+ #[cfg(feature = "unstable-notifications")]
+ /// See [`Notification::ProbeFailed`]
+ ProbeFailed(ProbeNumber, T),
}
/// Timer is an event that's scheduled by a [`Runtime`]. You won't need