hyperlane-plugin-maintenance 23.3.0

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

hyperlane-plugin-maintenance

Lock-free atomic maintenance and read-only mode middleware for Hyperlane.

Features

  • Single atomic load on the Active fast path (zero allocations, zero locks).
  • Instant zero-restart live transitions between Active, ReadOnly (blocks non-safe HTTP methods), and Maintenance.
  • Exact path exemptions, segment-bounded prefix exemptions, and constant-time secret header token bypasses.
  • Prebuilt 503 Service Unavailable wire buffers with configurable Retry-After and JSON/text payloads.
  • Transparent (Status::Continue) when unconfigured (#[hyperlane::request_middleware(-109)]).

Quick Start

use hyperlane_plugin_maintenance::{MaintenanceConfig, MaintenanceMode, MaintenancePlugin};

let plugin = MaintenancePlugin::init(
    MaintenanceConfig::default()
        .with_exempt_paths(["/healthz", "/readyz"])
        .with_bypass_tokens("X-Maintenance-Bypass", ["ops-secret"]),
);

plugin.set_mode(MaintenanceMode::ReadOnly);