Load `change_id`'s spans into the in-memory index on first access.
(&self, change_id: u64)
| 1504 | |
| 1505 | /// Load `change_id`'s spans into the in-memory index on first access. |
| 1506 | fn ensure_span_index(&self, change_id: u64) -> PristineResult<()> { |
| 1507 | if self.span_index.lock().unwrap().contains_change(change_id) { |
| 1508 | return Ok(()); |
| 1509 | } |
| 1510 | let start_key = encode_vertex(change_id, 0, 0); |
| 1511 | let end_key = encode_vertex(change_id, u64::MAX, u64::MAX); |
| 1512 | let mut set = std::collections::BTreeSet::new(); |
| 1513 | for result in self.graph_table.range::<&[u8; 24]>(&start_key..=&end_key)? { |
| 1514 | let (key, _values) = result?; |
| 1515 | let (v_change, v_start, v_end) = decode_vertex(key.value()); |
| 1516 | if v_change != change_id { |
| 1517 | continue; |
| 1518 | } |
| 1519 | set.insert((v_start, v_end)); |
| 1520 | } |
| 1521 | self.span_index |
| 1522 | .lock() |
| 1523 | .unwrap() |
| 1524 | .insert_change(change_id, set); |
| 1525 | Ok(()) |
| 1526 | } |
| 1527 | } |
| 1528 | |
| 1529 | impl<'txn> GraphTxnT for CachedGraphTxn<'txn> { |
no test coverage detected