Expand description
Hot-Reload Without Restart
This module implements zero-downtime plugin upgrades using atomic swapping and epoch-based draining.
§Design
┌───────────────────────────┐
│ HotReloadablePlugin │
│ │
│ ┌─────────────────────┐ │
│ │ Arc<Current Plugin> │ │
│ └──────────┬──────────┘ │
│ │ │
New Version ──────►│ ┌──────────▼──────────┐ │
│ │ prepare_upgrade() │ │
│ └──────────┬──────────┘ │
│ │ │
│ ┌──────────▼──────────┐ │
│ │ drain_in_flight() │ │
│ └──────────┬──────────┘ │
│ │ │
│ ┌──────────▼──────────┐ │
│ │ atomic_swap() │ │
│ └──────────┬──────────┘ │
│ │ │
│ ┌──────────▼──────────┐ │
│ │ cleanup_old() │ │
│ └─────────────────────┘ │
└───────────────────────────┘§Safety Properties
- No Request Drops: In-flight calls complete on old version
- Atomic Transition: New calls immediately use new version
- Memory Safety: Old version freed only when refs drop to zero
- Rollback: If new version fails, old version remains active
Structs§
- Epoch
Guard - Guard that releases epoch reference on drop
- Epoch
Tracker - Epoch counter for tracking in-flight operations
- HotReload
Manager - Manager for all hot-reloadable plugins
- HotReload
Stats - Statistics for hot-reload operations
- HotReloadable
Plugin - A hot-reloadable plugin wrapper
Enums§
- HotReload
State - State of a hot-reloadable plugin