hyperlane-plugin-maintenance 23.3.1

A lock-free atomic maintenance and read-only mode plugin for the Hyperlane framework with live zero-restart switching, path and constant-time bypass-token exemptions, Retry-After headers, and prebuilt 503 wire responses.
Documentation
/// Default HTTP bypass header name (`x-maintenance-bypass`).
pub const DEFAULT_BYPASS_HEADER: &str = "x-maintenance-bypass";

/// Default `Content-Type` emitted for maintenance `503` responses.
pub const DEFAULT_MAINTENANCE_CONTENT_TYPE: &str = "application/json; charset=utf-8";

/// Default `Retry-After` header value in seconds (`120`).
pub const DEFAULT_RETRY_AFTER_SECS: u64 = 120;

/// Default JSON body emitted while in full maintenance mode.
pub const DEFAULT_MAINTENANCE_BODY: &[u8] =
    br#"{"error":"service_unavailable","message":"service is under scheduled maintenance"}"#;

/// Default JSON body emitted when a write request is blocked in read-only mode.
pub const DEFAULT_READ_ONLY_BODY: &[u8] =
    br#"{"error":"read_only_mode","message":"service is temporarily in read-only mode"}"#;

/// Exact exempt path count threshold switching from linear scan to hash set.
pub(crate) const EXEMPT_SET_THRESHOLD: usize = 8;

/// Encoded atomic tag for [`MaintenanceMode::Active`].
pub(crate) const MODE_TAG_ACTIVE: u8 = 0;

/// Encoded atomic tag for [`MaintenanceMode::ReadOnly`].
pub(crate) const MODE_TAG_READ_ONLY: u8 = 1;

/// Encoded atomic tag for [`MaintenanceMode::Maintenance`].
pub(crate) const MODE_TAG_MAINTENANCE: u8 = 2;

/// Root slash path constant.
pub(crate) const ROOT_SLASH: &str = "/";