(
&mut self,
txn: &T,
inode: Inode,
)
| 833 | } |
| 834 | |
| 835 | fn load<T>( |
| 836 | &mut self, |
| 837 | txn: &T, |
| 838 | inode: Inode, |
| 839 | ) -> Result<&ImportGraphFirstInodeCache, RepositoryError> |
| 840 | where |
| 841 | T: TreeTxnT, |
| 842 | { |
| 843 | if let std::collections::hash_map::Entry::Vacant(entry) = self.by_inode.entry(inode) { |
| 844 | let mut inode_cache = ImportGraphFirstInodeCache::default(); |
| 845 | let vertices = txn |
| 846 | .iter_inode_vertices(inode) |
| 847 | .map_err(|e| RepositoryError::Database(e.to_string()))?; |
| 848 | for result in vertices { |
| 849 | let (node, _edge) = result.map_err(|e| RepositoryError::Database(e.to_string()))?; |
| 850 | inode_cache.by_end.entry(node.end_pos()).or_insert(node); |
| 851 | inode_cache |
| 852 | .by_start |
| 853 | .entry(node.start_pos()) |
| 854 | .and_modify(|existing| { |
| 855 | if existing.start == existing.end && node.start != node.end { |
| 856 | *existing = node; |
| 857 | } |
| 858 | }) |
| 859 | .or_insert(node); |
| 860 | } |
| 861 | entry.insert(inode_cache); |
| 862 | } |
| 863 | |
| 864 | self.by_inode.get(&inode).ok_or_else(|| { |
| 865 | RepositoryError::Apply(format!( |
| 866 | "missing import vertex cache for inode {}", |
| 867 | inode.get() |
| 868 | )) |
| 869 | }) |
| 870 | } |
| 871 | } |
| 872 | |
| 873 | type PendingImportEdge = ( |
no test coverage detected