MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / count_inode_vertices

Method count_inode_vertices

atomic-core/src/pristine/inode_graph/impls.rs:230–252  ·  view source on GitHub ↗
(&self, inode: Inode)

Source from the content-addressed store, hash-verified

228 }
229
230 fn count_inode_vertices(&self, inode: Inode) -> Result<usize, Self::InodeError> {
231 let table = self.txn.open_multimap_table(INODE_GRAPH)?;
232
233 let inode_id = inode.get();
234 let start_key = encode_inode_vertex(inode_id, 0, 0, 0);
235 let end_key = encode_inode_vertex(inode_id, u64::MAX, u64::MAX, u64::MAX);
236
237 let mut count = 0;
238 let mut last_vertex: Option<(u64, u64, u64)> = None;
239
240 for result in table.range::<&[u8; 32]>(&start_key..=&end_key)? {
241 let (key, _values) = result?;
242 let (_, change_id, start, end) = decode_inode_vertex(key.value());
243
244 let current = (change_id, start, end);
245 if last_vertex != Some(current) {
246 count += 1;
247 last_vertex = Some(current);
248 }
249 }
250
251 Ok(count)
252 }
253}
254
255// ═══════════════════════════════════════════════════════════════════════

Callers 1

Calls 3

encode_inode_vertexFunction · 0.85
decode_inode_vertexFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected