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

Function load_binary_registry_from_dir

crates/openshell-prover/src/registry.rs:253–273  ·  view source on GitHub ↗

Load binary registry from a filesystem directory override.

(registry_dir: &std::path::Path)

Source from the content-addressed store, hash-verified

251
252/// Load binary registry from a filesystem directory override.
253pub fn load_binary_registry_from_dir(registry_dir: &std::path::Path) -> Result<BinaryRegistry> {
254 let mut binaries = HashMap::new();
255 let binaries_dir = registry_dir.join("binaries");
256 if binaries_dir.is_dir() {
257 let entries = std::fs::read_dir(&binaries_dir)
258 .into_diagnostic()
259 .wrap_err_with(|| format!("reading directory {}", binaries_dir.display()))?;
260 for entry in entries {
261 let entry = entry.into_diagnostic()?;
262 let path = entry.path();
263 if path.extension().is_some_and(|ext| ext == "yaml") {
264 let contents = std::fs::read_to_string(&path)
265 .into_diagnostic()
266 .wrap_err_with(|| format!("reading {}", path.display()))?;
267 let cap = parse_binary_capability(&contents, &path.display().to_string())?;
268 binaries.insert(cap.path.clone(), cap);
269 }
270 }
271 }
272 Ok(BinaryRegistry { binaries })
273}
274
275/// Accessor for the embedded registry (used by credentials module for API descriptors).
276pub fn embedded_registry() -> &'static Dir<'static> {

Callers 1

proveFunction · 0.85

Calls 2

parse_binary_capabilityFunction · 0.85
pathMethod · 0.80

Tested by

no test coverage detected