Enum ockam_node::ShutdownType
source · #[non_exhaustive]pub enum ShutdownType {
Graceful(u8),
Immediate,
}
Expand description
Specify the type of node shutdown
For most users ShutdownType::Graceful()
is recommended. The
Default
implementation uses a 1 second timeout.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Graceful(u8)
Execute a graceful shutdown given a maximum timeout
The following steps will be taken by the internal router during graceful shutdown procedure:
- Signal clusterless workers to stop
- Wait for shutdown ACK hooks from worker set
- Signal worker clusters in reverse-creation order to stop
- Wait for shutdown ACK hooks from each cluster before moving onto the next
- All shutdown-signaled workers may process their entire mailbox, while not allowing new messages to be queued
Graceful shutdown procedure will be pre-maturely terminated
when reaching the timeout (failover into Immediate
strategy). A given timeout of 0
will wait forever!
Immediate
Immediately shutdown workers and run shutdown hooks
This strategy can lead to data loss:
- Unhandled mailbox messages will be dropped
- Shutdown hooks may not be able to send messages
This strategy is not recommended for general use, but will be
selected as a failover, if the Graceful
strategy reaches its
timeout limit.
Trait Implementations§
source§impl Clone for ShutdownType
impl Clone for ShutdownType
source§fn clone(&self) -> ShutdownType
fn clone(&self) -> ShutdownType
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ShutdownType
impl Debug for ShutdownType
source§impl Default for ShutdownType
impl Default for ShutdownType
impl Copy for ShutdownType
Auto Trait Implementations§
impl RefUnwindSafe for ShutdownType
impl Send for ShutdownType
impl Sync for ShutdownType
impl Unpin for ShutdownType
impl UnwindSafe for ShutdownType
Blanket Implementations§
source§impl<D> AsyncTryClone for D
impl<D> AsyncTryClone for D
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