pub struct ReloadablePolicy { /* private fields */ }Expand description
A hot-reloadable Policy holder for the enforcement point: the
active policy can be swapped at runtime (e.g. when the policy file
changes) without a restart, while readers keep the coarse
evaluate path lock-light.
It wraps an Arc<Policy> behind an RwLock. Per request the guard
calls current — a brief read-lock returning a
cheap Arc clone it then evaluates against; a reload calls
store — a brief write-lock swapping the Arc. A
request in flight during a reload finishes against the snapshot it
took, so a swap is never observed mid-evaluation. Poison-safe: a
panic elsewhere never makes current/store panic (verifier rule:
no panics in the API).
The trigger (a file-mtime watch, a signal, an admin endpoint) is the service’s concern — this type only holds and swaps the value.