MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / execute_graph_hop

Method execute_graph_hop

nodedb/src/data/executor/handlers/graph.rs:247–294  ·  view source on GitHub ↗
(
        &self,
        task: &ExecutionTask,
        tid: u64,
        start_nodes: &[String],
        edge_label: &Option<String>,
        direction: crate::engine::graph::edge_store::Direction,
  

Source from the content-addressed store, hash-verified

245
246 #[allow(clippy::too_many_arguments)]
247 pub(in crate::data::executor) fn execute_graph_hop(
248 &self,
249 task: &ExecutionTask,
250 tid: u64,
251 start_nodes: &[String],
252 edge_label: &Option<String>,
253 direction: crate::engine::graph::edge_store::Direction,
254 depth: usize,
255 frontier_bitmap: Option<&nodedb_types::SurrogateBitmap>,
256 ) -> Response {
257 debug!(
258 core = self.core_id,
259 tid,
260 ?start_nodes,
261 ?edge_label,
262 ?direction,
263 depth,
264 "graph hop"
265 );
266 let depth = depth.min(crate::engine::graph::traversal_options::MAX_GRAPH_TRAVERSAL_DEPTH);
267 let refs: Vec<&str> = start_nodes.iter().map(String::as_str).collect();
268 let result: Vec<String> = match self.csr_partition(tid) {
269 Some(partition) => partition.traverse_bfs(
270 &refs,
271 edge_label.as_deref(),
272 direction,
273 depth,
274 self.graph_tuning.max_visited,
275 frontier_bitmap,
276 ),
277 None => Vec::new(),
278 };
279 if let Some(ref m) = self.metrics {
280 m.record_graph_traversal();
281 }
282 match super::super::response_codec::encode(&result) {
283 Ok(payload) => self.response_with_payload(task, payload),
284 Err(e) => {
285 warn!(core = self.core_id, layer = DiagnosticLayer::WireShape.as_str(), error = %e, "graph hop serialization failed");
286 self.response_error(
287 task,
288 ErrorCode::Internal {
289 detail: e.to_string(),
290 },
291 )
292 }
293 }
294 }
295
296 pub(in crate::data::executor) fn execute_graph_neighbors(
297 &self,

Callers 1

dispatch_graphMethod · 0.80

Calls 9

collectMethod · 0.80
csr_partitionMethod · 0.80
traverse_bfsMethod · 0.80
response_with_payloadMethod · 0.80
response_errorMethod · 0.80
to_stringMethod · 0.80
encodeFunction · 0.50
iterMethod · 0.45

Tested by

no test coverage detected