Load `change_id`'s spans into the in-memory index on first access.
(&self, change_id: u64)
| 1459 | |
| 1460 | /// Load `change_id`'s spans into the in-memory index on first access. |
| 1461 | fn ensure_span_index(&self, change_id: u64) -> PristineResult<()> { |
| 1462 | if self.span_index.lock().unwrap().contains_change(change_id) { |
| 1463 | return Ok(()); |
| 1464 | } |
| 1465 | let start_key = encode_vertex(change_id, 0, 0); |
| 1466 | let end_key = encode_vertex(change_id, u64::MAX, u64::MAX); |
| 1467 | let mut set = std::collections::BTreeSet::new(); |
| 1468 | for result in self.graph_table.range::<&[u8; 24]>(&start_key..=&end_key)? { |
| 1469 | let (key, _values) = result?; |
| 1470 | let (v_change, v_start, v_end) = decode_vertex(key.value()); |
| 1471 | if v_change != change_id { |
| 1472 | continue; |
| 1473 | } |
| 1474 | set.insert((v_start, v_end)); |
| 1475 | } |
| 1476 | self.span_index |
| 1477 | .lock() |
| 1478 | .unwrap() |
| 1479 | .insert_change(change_id, set); |
| 1480 | Ok(()) |
| 1481 | } |
| 1482 | } |
| 1483 | |
| 1484 | impl<'txn> GraphTxnT for CachedGraphTxn<'txn> { |
no test coverage detected