Load the unhashed data for a change (if any). Returns `None` if no unhashed data is stored.
(&self, hash: &[u8; 32])
| 224 | /// |
| 225 | /// Returns `None` if no unhashed data is stored. |
| 226 | pub fn load_unhashed(&self, hash: &[u8; 32]) -> RedbStoreResult<Option<serde_json::Value>> { |
| 227 | let txn = self.db().begin_read()?; |
| 228 | let table = txn.open_table(tables::CHANGE_UNHASHED)?; |
| 229 | |
| 230 | match table.get(hash)? { |
| 231 | Some(value) => { |
| 232 | let compressed = value.value(); |
| 233 | let decompressed = zstd::decode_all(compressed).map_err(|e| { |
| 234 | RedbStoreError::Corrupt(format!("unhashed decompression failed: {}", e)) |
| 235 | })?; |
| 236 | let json: serde_json::Value = serde_json::from_slice(&decompressed)?; |
| 237 | Ok(Some(json)) |
| 238 | } |
| 239 | None => Ok(None), |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | // ── Statistics ────────────────────────────────────────────────── |
| 244 |