MCPcopy Create free account
hub / github.com/RetypeOS/parcode / inspect_node

Method inspect_node

src/inspector.rs:79–109  ·  view source on GitHub ↗
(node: &ChunkNode<'_>)

Source from the content-addressed store, hash-verified

77 }
78
79 fn inspect_node(node: &ChunkNode<'_>) -> Result<ChunkInfo> {
80 let raw_meta = node.meta();
81 let algo_id = raw_meta.compression_method();
82 let algo_name = match algo_id {
83 0 => "None".to_string(),
84 1 => "LZ4".to_string(),
85 _ => format!("Unknown({})", algo_id),
86 };
87
88 let (hint, distrib) = Self::analyze_payload(node);
89
90 let mut children_info = Vec::new();
91 if node.child_count() > 0 {
92 let children = node.children()?;
93 for child in children {
94 children_info.push(Self::inspect_node(&child)?);
95 }
96 }
97
98 Ok(ChunkInfo {
99 offset: node.offset(),
100 total_length: node.length(),
101 payload_size: node.payload_len(),
102 child_count: node.child_count(),
103 compression_algo: algo_name,
104 is_chunkable: raw_meta.is_chunkable(),
105 node_type_hint: hint,
106 distribution_info: distrib,
107 children: children_info,
108 })
109 }
110
111 fn analyze_payload(node: &ChunkNode<'_>) -> (String, Option<String>) {
112 if node.child_count() == 0 {

Callers

nothing calls this directly

Calls 8

metaMethod · 0.80
compression_methodMethod · 0.80
child_countMethod · 0.80
childrenMethod · 0.80
offsetMethod · 0.80
lengthMethod · 0.80
payload_lenMethod · 0.80
is_chunkableMethod · 0.80

Tested by

no test coverage detected