#[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)

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Try cloning a object and return an Err in case of failure.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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