Load `change_id`'s spans into the in-memory index on first access.
(&self, change_id: u64)
| 1441 | |
| 1442 | /// Load `change_id`'s spans into the in-memory index on first access. |
| 1443 | fn ensure_span_index(&self, change_id: u64) -> PristineResult<()> { |
| 1444 | if self.span_index.lock().unwrap().contains_change(change_id) { |
| 1445 | return Ok(()); |
| 1446 | } |
| 1447 | let start_key = encode_vertex(change_id, 0, 0); |
| 1448 | let end_key = encode_vertex(change_id, u64::MAX, u64::MAX); |
| 1449 | let mut set = std::collections::BTreeSet::new(); |
| 1450 | for result in self.graph_table.range::<&[u8; 24]>(&start_key..=&end_key)? { |
| 1451 | let (key, _values) = result?; |
| 1452 | let (v_change, v_start, v_end) = decode_vertex(key.value()); |
| 1453 | if v_change != change_id { |
| 1454 | continue; |
| 1455 | } |
| 1456 | set.insert((v_start, v_end)); |
| 1457 | } |
| 1458 | self.span_index |
| 1459 | .lock() |
| 1460 | .unwrap() |
| 1461 | .insert_change(change_id, set); |
| 1462 | Ok(()) |
| 1463 | } |
| 1464 | } |
| 1465 | |
| 1466 | impl<'txn> GraphTxnT for CachedGraphTxn<'txn> { |
no test coverage detected