# hyperlane-plugin-maintenance
Lock-free atomic maintenance and read-only mode middleware for [Hyperlane](https://github.com/hyperlane-dev/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
```rust
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);
```