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
Graceful(u8)
Tuple Fields
0: 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-signalled 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
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
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more