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

Method wasm_write

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

Execute a write transaction on the WASM_MODULES table.

(&self, op: &str, f: F)

Source from the content-addressed store, hash-verified

65
66 /// Execute a write transaction on the WASM_MODULES table.
67 fn wasm_write<F, T>(&self, op: &str, f: F) -> crate::Result<T>
68 where
69 F: FnOnce(&mut redb::Table<&str, &[u8]>) -> crate::Result<T>,
70 {
71 let txn = self
72 .db
73 .begin_write()
74 .map_err(|e| catalog_err(&format!("{op} txn"), e))?;
75 let result = {
76 let mut table = txn
77 .open_table(WASM_MODULES)
78 .map_err(|e| catalog_err(&format!("{op} open"), e))?;
79 f(&mut table)?
80 };
81 txn.commit()
82 .map_err(|e| catalog_err(&format!("{op} commit"), e))?;
83 Ok(result)
84 }
85
86 /// Store raw bytes under a string key in the WASM_MODULES table.
87 pub fn put_raw(&self, key: &[u8], value: &[u8]) -> crate::Result<()> {

Callers 2

put_rawMethod · 0.80
delete_rawMethod · 0.80

Calls 3

begin_writeMethod · 0.80
catalog_errFunction · 0.70
commitMethod · 0.45

Tested by

no test coverage detected