Ensure all of `change_id`'s spans are loaded into the in-memory index. Runs a single GRAPH range scan the first time a change is queried; later calls are no-ops. Writes during the batch keep the set current via [`VertexSpanIndex::note_write`], so the scan never has to be repeated.
(&self, change_id: u64)
| 53 | /// calls are no-ops. Writes during the batch keep the set current via |
| 54 | /// [`VertexSpanIndex::note_write`], so the scan never has to be repeated. |
| 55 | fn ensure_loaded(&self, change_id: u64) -> PristineResult<()> { |
| 56 | if self.index.borrow().contains_change(change_id) { |
| 57 | return Ok(()); |
| 58 | } |
| 59 | let start_key = encode_vertex(change_id, 0, 0); |
| 60 | let end_key = encode_vertex(change_id, u64::MAX, u64::MAX); |
| 61 | let mut set = BTreeSet::new(); |
| 62 | for result in self.graph.range::<&[u8; 24]>(&start_key..=&end_key)? { |
| 63 | let (key, _) = result?; |
| 64 | let (v_change, v_start, v_end) = decode_vertex(key.value()); |
| 65 | if v_change != change_id { |
| 66 | continue; |
| 67 | } |
| 68 | set.insert((v_start, v_end)); |
| 69 | } |
| 70 | self.index.borrow_mut().insert_change(change_id, set); |
| 71 | Ok(()) |
| 72 | } |
| 73 | |
| 74 | pub fn put_graph( |
| 75 | &mut self, |
no test coverage detected