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

Method count_inode_vertices

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

Source from the content-addressed store, hash-verified

127 super::probe::find_block_end_in_inode(&table, inode, pos)
128 }
129 fn count_inode_vertices(&self, inode: Inode) -> Result<usize, Self::InodeError> {
130 let table = self.txn.open_multimap_table(INODE_GRAPH)?;
131
132 let inode_id = inode.get();
133 let start_key = encode_inode_vertex(inode_id, 0, 0, 0);
134 let end_key = encode_inode_vertex(inode_id, u64::MAX, u64::MAX, u64::MAX);
135
136 let mut count = 0;
137 let mut last_vertex: Option<(u64, u64, u64)> = None;
138
139 for result in table.range::<&[u8; 32]>(&start_key..=&end_key)? {
140 let (key, _values) = result?;
141 let (_, change_id, start, end) = decode_inode_vertex(key.value());
142
143 let current = (change_id, start, end);
144 if last_vertex != Some(current) {
145 count += 1;
146 last_vertex = Some(current);
147 }
148 }
149
150 Ok(count)
151 }
152}
153
154// ═══════════════════════════════════════════════════════════════════════

Callers

nothing calls this directly

Calls 4

encode_inode_vertexFunction · 0.85
decode_inode_vertexFunction · 0.85
valueMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected