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>)
| 220 | /// |
| 221 | /// Returns an empty `Vec` for root or empty (structural) vertices. |
| 222 | fn get_vertex_content(&self, vertex: &GraphNode<NodeId>) -> Result<Vec<u8>, PristineError> { |
| 223 | if vertex.is_root() || vertex.start == vertex.end { |
| 224 | return Ok(Vec::new()); |
| 225 | } |
| 226 | |
| 227 | let len = vertex.end.get().saturating_sub(vertex.start.get()) as usize; |
| 228 | if len == 0 { |
| 229 | return Ok(Vec::new()); |
| 230 | } |
| 231 | |
| 232 | let mut buf = vec![0u8; len]; |
| 233 | |
| 234 | let txn = self.txn; |
| 235 | let hash_fn = |id: NodeId| -> Option<Hash> { txn.get_external(id).ok().flatten() }; |
| 236 | |
| 237 | self.changes |
| 238 | .get_contents(hash_fn, *vertex, &mut buf) |
| 239 | .map_err(|e| PristineError::Inconsistent { |
| 240 | message: format!("ChangeStore::get_contents failed for {}: {}", vertex, e), |
| 241 | })?; |
| 242 | |
| 243 | Ok(buf) |
| 244 | } |
| 245 | |
| 246 | /// Walk deleted forward edges from `parent` to find a dead vertex that |
| 247 | /// was deleted by both `left_change` and `right_change`. |
no test coverage detected