Execute a write transaction on the WASM_MODULES table.
(&self, op: &str, f: F)
| 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<()> { |
no test coverage detected