Skip to main content

Module plugin_hot_reload

Module plugin_hot_reload 

Source
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

  1. No Request Drops: In-flight calls complete on old version
  2. Atomic Transition: New calls immediately use new version
  3. Memory Safety: Old version freed only when refs drop to zero
  4. Rollback: If new version fails, old version remains active

Structs§

EpochGuard
Guard that releases epoch reference on drop
EpochTracker
Epoch counter for tracking in-flight operations
HotReloadManager
Manager for all hot-reloadable plugins
HotReloadStats
Statistics for hot-reload operations
HotReloadablePlugin
A hot-reloadable plugin wrapper

Enums§

HotReloadState
State of a hot-reloadable plugin