Read the content bytes for a graph vertex from the change store. Returns an empty `Vec` for root or empty (structural) vertices.
(&self, vertex: &GraphNode<NodeId>)
| 305 | /// |
| 306 | /// Returns an empty `Vec` for root or empty (structural) vertices. |
| 307 | fn get_vertex_content(&self, vertex: &GraphNode<NodeId>) -> Result<Vec<u8>, PristineError> { |
| 308 | if vertex.is_root() || vertex.start == vertex.end { |
| 309 | return Ok(Vec::new()); |
| 310 | } |
| 311 | |
| 312 | let len = vertex.end.get().saturating_sub(vertex.start.get()) as usize; |
| 313 | if len == 0 { |
| 314 | return Ok(Vec::new()); |
| 315 | } |
| 316 | |
| 317 | let mut buf = vec![0u8; len]; |
| 318 | |
| 319 | let txn = self.txn; |
| 320 | let hash_fn = |id: NodeId| -> Option<Hash> { txn.get_external(id).ok().flatten() }; |
| 321 | |
| 322 | self.changes |
| 323 | .get_contents(hash_fn, *vertex, &mut buf) |
| 324 | .map_err(|e| PristineError::Inconsistent { |
| 325 | message: format!("ChangeStore::get_contents failed for {}: {}", vertex, e), |
| 326 | })?; |
| 327 | |
| 328 | Ok(buf) |
| 329 | } |
| 330 | |
| 331 | /// Walk deleted forward edges from `parent` to find a dead vertex that |
| 332 | /// was deleted by both `left_change` and `right_change`. |
no test coverage detected