MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / load_wasm_binary

Function load_wasm_binary

nodedb/src/control/planner/wasm/store.rs:54–67  ·  view source on GitHub ↗

Load a WASM binary from the system catalog by its content hash.

(
    catalog: &crate::control::security::catalog::types::SystemCatalog,
    hash: &str,
)

Source from the content-addressed store, hash-verified

52
53/// Load a WASM binary from the system catalog by its content hash.
54pub fn load_wasm_binary(
55 catalog: &crate::control::security::catalog::types::SystemCatalog,
56 hash: &str,
57) -> crate::Result<Vec<u8>> {
58 let key = format!("wasm_module:{hash}");
59 catalog
60 .get_raw(key.as_bytes())
61 .map_err(|e| crate::Error::Internal {
62 detail: format!("failed to load WASM binary: {e}"),
63 })?
64 .ok_or_else(|| crate::Error::BadRequest {
65 detail: format!("WASM module with hash '{hash}' not found"),
66 })
67}
68
69/// Delete a WASM binary from the catalog by its content hash.
70pub fn delete_wasm_binary(

Callers

nothing calls this directly

Calls 2

get_rawMethod · 0.45
as_bytesMethod · 0.45

Tested by

no test coverage detected