pub struct ServiceReadyNotifier { /* private fields */ }Expand description
A notification channel for signaling when a service has become ready.
Services can use this to notify other services that may depend on them that they have successfully started and are ready to serve requests.
§Example
ⓘ
use pingora_core::services::ServiceReadyNotifier;
async fn my_service(ready_notifier: ServiceReadyNotifier) {
// Perform initialization...
// Signal that the service is ready
ready_notifier.notify_ready();
// Continue with main service loop...
}Implementations§
Source§impl ServiceReadyNotifier
impl ServiceReadyNotifier
Sourcepub fn new(sender: Sender<bool>) -> Self
pub fn new(sender: Sender<bool>) -> Self
Creates a new ServiceReadyNotifier from a watch sender. You will not need to create one of these for normal usage, but being able to is useful for testing.
Sourcepub fn notify_ready(self)
pub fn notify_ready(self)
Notifies dependent services that this service is ready.
Consumes the notifier to ensure ready is only signaled once.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ServiceReadyNotifier
impl RefUnwindSafe for ServiceReadyNotifier
impl Send for ServiceReadyNotifier
impl Sync for ServiceReadyNotifier
impl Unpin for ServiceReadyNotifier
impl UnsafeUnpin for ServiceReadyNotifier
impl UnwindSafe for ServiceReadyNotifier
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more