The rows `record` reads for `inodes`, on the view `view_id`. `visible` is the view's change set, and it bounds the CRDT rows as well as the graph — see the private `export_crdt` below.
(
&self,
inodes: &[u64],
view_id: u64,
visible: &BTreeSet<u64>,
)
| 201 | /// `visible` is the view's change set, and it bounds the CRDT rows as well |
| 202 | /// as the graph — see the private `export_crdt` below. |
| 203 | pub fn export_graph_slice( |
| 204 | &self, |
| 205 | inodes: &[u64], |
| 206 | view_id: u64, |
| 207 | visible: &BTreeSet<u64>, |
| 208 | ) -> PristineResult<GraphSlice> { |
| 209 | let mut out = GraphSlice::default(); |
| 210 | let inode_table = self.txn.open_table(INODES)?; |
| 211 | let rev_inodes = self.txn.open_table(REV_INODES)?; |
| 212 | let graph = self.txn.open_multimap_table(GRAPH)?; |
| 213 | let inode_graph = self.txn.open_multimap_table(INODE_GRAPH)?; |
| 214 | let conflicts = self.txn.open_table(CONFLICTS)?; |
| 215 | |
| 216 | let edges_of = |key: &[u8; 24]| -> PristineResult<Vec<[u8; 24]>> { |
| 217 | let mut edges = Vec::new(); |
| 218 | for e in graph.get(key)? { |
| 219 | edges.push(*e?.value()); |
| 220 | } |
| 221 | Ok(edges) |
| 222 | }; |
| 223 | let is_inode_vertex = |node: GraphNode<NodeId>| -> PristineResult<bool> { |
| 224 | Ok(node.start == node.end |
| 225 | && rev_inodes |
| 226 | .get(&encode_position(node.change.get(), node.start.get()))? |
| 227 | .is_some()) |
| 228 | }; |
| 229 | |
| 230 | // Each vertex once, at the widest reach any path gives it. |
| 231 | let mut reach: BTreeMap<[u8; 24], Reach> = BTreeMap::new(); |
| 232 | let mut queue: VecDeque<(GraphNode<NodeId>, Reach)> = VecDeque::new(); |
| 233 | let enqueue = |node: GraphNode<NodeId>, |
| 234 | r: Reach, |
| 235 | reach: &mut BTreeMap<[u8; 24], Reach>, |
| 236 | queue: &mut VecDeque<(GraphNode<NodeId>, Reach)>| { |
| 237 | if node.is_root() { |
| 238 | // Path-claim reconstruction validates the canonical parent → |
| 239 | // name edge. Include ROOT's row without traversing all files. |
| 240 | reach.entry(vertex_key(node)).or_insert(Reach::Row); |
| 241 | return; |
| 242 | } |
| 243 | let key = vertex_key(node); |
| 244 | if reach.get(&key).is_some_and(|have| *have >= r) { |
| 245 | return; |
| 246 | } |
| 247 | reach.insert(key, r); |
| 248 | queue.push_back((node, r)); |
| 249 | }; |
| 250 | |
| 251 | for &inode in inodes { |
| 252 | let Some(pos) = inode_table.get(inode)? else { |
| 253 | continue; |
| 254 | }; |
| 255 | let (change, p) = decode_position(pos.value()); |
| 256 | let seed = GraphNode { |
| 257 | change: NodeId::new(change), |
| 258 | start: ChangePosition::new(p), |
| 259 | end: ChangePosition::new(p), |
| 260 | }; |
no test coverage detected