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

Method get_raw

nodedb/src/control/security/catalog/system_catalog.rs:98–114  ·  view source on GitHub ↗

Load raw bytes by string key from the WASM_MODULES table.

(&self, key: &[u8])

Source from the content-addressed store, hash-verified

96
97 /// Load raw bytes by string key from the WASM_MODULES table.
98 pub fn get_raw(&self, key: &[u8]) -> crate::Result<Option<Vec<u8>>> {
99 let key_str = std::str::from_utf8(key).map_err(|e| catalog_err("get_raw key", e))?;
100 let txn = self
101 .db
102 .begin_read()
103 .map_err(|e| catalog_err("get_raw txn", e))?;
104 let table = txn
105 .open_table(WASM_MODULES)
106 .map_err(|e| catalog_err("get_raw open", e))?;
107 match table
108 .get(key_str)
109 .map_err(|e| catalog_err("get_raw get", e))?
110 {
111 Some(v) => Ok(Some(v.value().to_vec())),
112 None => Ok(None),
113 }
114 }
115
116 /// Delete raw bytes by string key from the WASM_MODULES table.
117 pub fn delete_raw(&self, key: &[u8]) -> crate::Result<()> {

Callers 1

load_wasm_binaryFunction · 0.45

Calls 3

catalog_errFunction · 0.70
getMethod · 0.45
to_vecMethod · 0.45

Tested by

no test coverage detected