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

Method execute_graph_neighbors

nodedb/src/data/executor/handlers/graph.rs:296–333  ·  view source on GitHub ↗
(
        &self,
        task: &ExecutionTask,
        tid: u64,
        node_id: &str,
        edge_label: &Option<String>,
        direction: crate::engine::graph::edge_store::Direction,
    )

Source from the content-addressed store, hash-verified

294 }
295
296 pub(in crate::data::executor) fn execute_graph_neighbors(
297 &self,
298 task: &ExecutionTask,
299 tid: u64,
300 node_id: &str,
301 edge_label: &Option<String>,
302 direction: crate::engine::graph::edge_store::Direction,
303 ) -> Response {
304 debug!(core = self.core_id, tid, %node_id, ?edge_label, ?direction, "graph neighbors");
305 let neighbors: Vec<(String, String)> = match self.csr_partition(tid) {
306 Some(partition) => partition.neighbors(node_id, edge_label.as_deref(), direction),
307 None => Vec::new(),
308 };
309 let result: Vec<_> = neighbors
310 .iter()
311 .map(
312 |(label, node)| super::super::response_codec::NeighborEntry {
313 label: label.as_str(),
314 node: node.as_str(),
315 },
316 )
317 .collect();
318 if let Some(ref m) = self.metrics {
319 m.record_graph_traversal();
320 }
321 match super::super::response_codec::encode(&result) {
322 Ok(payload) => self.response_with_payload(task, payload),
323 Err(e) => {
324 warn!(core = self.core_id, layer = DiagnosticLayer::WireShape.as_str(), error = %e, "graph neighbors serialization failed");
325 self.response_error(
326 task,
327 ErrorCode::Internal {
328 detail: e.to_string(),
329 },
330 )
331 }
332 }
333 }
334
335 pub(in crate::data::executor) fn execute_graph_neighbors_multi(
336 &self,

Callers 1

dispatch_graphMethod · 0.80

Calls 10

csr_partitionMethod · 0.80
collectMethod · 0.80
response_with_payloadMethod · 0.80
response_errorMethod · 0.80
to_stringMethod · 0.80
encodeFunction · 0.50
neighborsMethod · 0.45
iterMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected