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

Method expand_graph_op

atomic-core/src/change/format_v3/compact/convert.rs:181–324  ·  view source on GitHub ↗

Convert a [`CompactGraphOp`] to a `GraphOp >`. This is the main entry point for expanding a compact graph operation after deserialization. It recursively expands all nested positions, nodes, and hash indices. # Errors Returns an error if any hash index in the compact operation is out of bounds for the dedup table.

(&self, op: &CompactGraphOp)

Source from the content-addressed store, hash-verified

179 /// Returns an error if any hash index in the compact operation
180 /// is out of bounds for the dedup table.
181 pub fn expand_graph_op(&self, op: &CompactGraphOp) -> FormatResult<GraphOp<Option<Hash>>> {
182 match op {
183 CompactGraphOp::FileAdd {
184 add_name,
185 add_inode,
186 contents,
187 path,
188 encoding,
189 } => Ok(GraphOp::FileAdd {
190 add_name: self.expand_insertion(add_name)?,
191 add_inode: self.expand_insertion(add_inode)?,
192 contents: contents
193 .as_ref()
194 .map(|c| self.expand_insertion(c))
195 .transpose()?,
196 path: path.clone(),
197 encoding: *encoding,
198 }),
199
200 CompactGraphOp::DirAdd {
201 add_name,
202 add_inode,
203 path,
204 } => Ok(GraphOp::DirAdd {
205 add_name: self.expand_insertion(add_name)?,
206 add_inode: self.expand_insertion(add_inode)?,
207 path: path.clone(),
208 }),
209
210 CompactGraphOp::DirDel { del, path } => Ok(GraphOp::DirDel {
211 del: self.expand_edge_update(del)?,
212 path: path.clone(),
213 }),
214
215 CompactGraphOp::DirUndel { undel, path } => Ok(GraphOp::DirUndel {
216 undel: self.expand_edge_update(undel)?,
217 path: path.clone(),
218 }),
219
220 CompactGraphOp::FileDel {
221 del,
222 contents,
223 path,
224 encoding,
225 } => Ok(GraphOp::FileDel {
226 del: self.expand_edge_update(del)?,
227 contents: contents
228 .as_ref()
229 .map(|c| self.expand_edge_update(c))
230 .transpose()?,
231 path: path.clone(),
232 encoding: *encoding,
233 }),
234
235 CompactGraphOp::FileUndel {
236 undel,
237 contents,
238 path,

Calls 5

expand_insertionMethod · 0.80
as_refMethod · 0.80
expand_edge_updateMethod · 0.80
expand_atomMethod · 0.80
cloneMethod · 0.45