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-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§
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 more