hyperlane-plugin-shutdown 23.3.1

A graceful shutdown coordinator plugin for the Hyperlane framework providing OS signal arming (SIGINT/SIGTERM), lock-free in-flight request draining, bounded drain timeouts, LIFO async shutdown callbacks, and ServerControlHook integration.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/// Default maximum graceful drain window in milliseconds (30 seconds).
pub const DEFAULT_SHUTDOWN_DRAIN_TIMEOUT_MS: u64 = 30_000;

/// Default per-callback shutdown hook timeout in milliseconds (5 seconds).
pub const DEFAULT_SHUTDOWN_CALLBACK_TIMEOUT_MS: u64 = 5_000;

/// High bit of each shard's packed atomic state word indicating shutdown has been triggered.
pub(crate) const SHUTDOWN_BIT: usize = 1usize << (usize::BITS - 1);

/// Mask extracting the active in-flight guard count from a shard's packed atomic state word.
pub(crate) const IN_FLIGHT_MASK: usize = !SHUTDOWN_BIT;

/// Number of cache-line-isolated lock-free in-flight shards (power of two).
pub(crate) const SHUTDOWN_SHARD_COUNT: usize = 32;

/// Fibonacci golden-ratio multiplier used to map OS thread stacks uniformly onto shards.
pub(crate) const SHARD_HASH_MUL: u64 = 0x9E37_79B9_7F4A_7C15;