Load a WASM binary from the system catalog by its content hash.
(
catalog: &crate::control::security::catalog::types::SystemCatalog,
hash: &str,
)
| 52 | |
| 53 | /// Load a WASM binary from the system catalog by its content hash. |
| 54 | pub 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. |
| 70 | pub fn delete_wasm_binary( |