Load `change_id`'s spans into the in-memory index on first access.
(&self, change_id: u64)
| 1330 | |
| 1331 | /// Load `change_id`'s spans into the in-memory index on first access. |
| 1332 | fn ensure_span_index(&self, change_id: u64) -> PristineResult<()> { |
| 1333 | if self.span_index.lock().unwrap().contains_change(change_id) { |
| 1334 | return Ok(()); |
| 1335 | } |
| 1336 | let start_key = encode_vertex(change_id, 0, 0); |
| 1337 | let end_key = encode_vertex(change_id, u64::MAX, u64::MAX); |
| 1338 | let mut set = std::collections::BTreeSet::new(); |
| 1339 | for result in self.graph_table.range::<&[u8; 24]>(&start_key..=&end_key)? { |
| 1340 | let (key, _values) = result?; |
| 1341 | let (v_change, v_start, v_end) = decode_vertex(key.value()); |
| 1342 | if v_change != change_id { |
| 1343 | continue; |
| 1344 | } |
| 1345 | set.insert((v_start, v_end)); |
| 1346 | } |
| 1347 | self.span_index |
| 1348 | .lock() |
| 1349 | .unwrap() |
| 1350 | .insert_change(change_id, set); |
| 1351 | Ok(()) |
| 1352 | } |
| 1353 | } |
| 1354 | |
| 1355 | impl<'txn> GraphTxnT for CachedGraphTxn<'txn> { |
no test coverage detected