MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / reload

Method reload

crates/openshell-supervisor-network/src/opa.rs:380–393  ·  view source on GitHub ↗

Reload policy and data from strings (data is YAML). Designed for future gRPC hot-reload from the openshell gateway. Replaces the entire engine atomically. Routes through the full preprocessing pipeline (port normalization, L7 validation, preset expansion) to maintain consistency with `from_strings()`.

(&self, policy: &str, data_yaml: &str)

Source from the content-addressed store, hash-verified

378 /// preprocessing pipeline (port normalization, L7 validation, preset
379 /// expansion) to maintain consistency with `from_strings()`.
380 pub fn reload(&self, policy: &str, data_yaml: &str) -> Result<()> {
381 let new = Self::from_strings(policy, data_yaml)?;
382 let new_engine = new
383 .engine
384 .into_inner()
385 .map_err(|_| miette::miette!("lock poisoned on new engine"))?;
386 let mut engine = self
387 .engine
388 .lock()
389 .map_err(|_| miette::miette!("OPA engine lock poisoned"))?;
390 *engine = new_engine;
391 self.generation.fetch_add(1, Ordering::AcqRel);
392 Ok(())
393 }
394
395 /// Reload policy from a proto `SandboxPolicy` message.
396 ///

Calls

no outgoing calls