(
&self,
task: &ExecutionTask,
tid: u64,
query_bytes: &[u8],
frontier_bitmap: Option<&nodedb_types::SurrogateBitmap>,
)
| 11 | |
| 12 | impl CoreLoop { |
| 13 | pub(in crate::data::executor) fn execute_graph_match( |
| 14 | &self, |
| 15 | task: &ExecutionTask, |
| 16 | tid: u64, |
| 17 | query_bytes: &[u8], |
| 18 | frontier_bitmap: Option<&nodedb_types::SurrogateBitmap>, |
| 19 | ) -> Response { |
| 20 | debug!(core = self.core_id, tid, "graph match execution"); |
| 21 | |
| 22 | // Deserialize the MatchQuery from MessagePack. |
| 23 | let query: MatchQuery = match zerompk::from_msgpack(query_bytes) { |
| 24 | Ok(q) => q, |
| 25 | Err(e) => { |
| 26 | warn!(core = self.core_id, error = %e, "failed to deserialize MatchQuery"); |
| 27 | return self.response_error( |
| 28 | task, |
| 29 | ErrorCode::Internal { |
| 30 | detail: format!("invalid match query: {e}"), |
| 31 | }, |
| 32 | ); |
| 33 | } |
| 34 | }; |
| 35 | |
| 36 | // Execute the pattern match on the caller's CSR partition + |
| 37 | // EdgeStore. An absent partition means "this tenant has no |
| 38 | // graph state" — return the empty row set rather than error. |
| 39 | let partition = match self.csr_partition(tid) { |
| 40 | Some(p) => p, |
| 41 | None => { |
| 42 | let payload = match crate::engine::graph::pattern::executor::rows_to_msgpack(&[]) { |
| 43 | Ok(p) => p, |
| 44 | Err(e) => return self.response_error(task, ErrorCode::from(e)), |
| 45 | }; |
| 46 | return self.response_with_payload(task, payload); |
| 47 | } |
| 48 | }; |
| 49 | match crate::engine::graph::pattern::executor::execute( |
| 50 | &query, |
| 51 | partition, |
| 52 | &self.edge_store, |
| 53 | frontier_bitmap, |
| 54 | ) { |
| 55 | Ok(outcome) => { |
| 56 | match crate::engine::graph::pattern::executor::rows_to_msgpack(&outcome.rows) { |
| 57 | Ok(payload) => { |
| 58 | if outcome.truncated { |
| 59 | // Variable-length expansion hit a hard cap. |
| 60 | // Surface via the envelope's `partial` flag |
| 61 | // so merging / client response paths can see |
| 62 | // the incomplete result — silent truncation |
| 63 | // is not allowed. |
| 64 | self.response_partial(task, payload) |
| 65 | } else { |
| 66 | self.response_with_payload(task, payload) |
| 67 | } |
| 68 | } |
| 69 | Err(e) => self.response_error(task, ErrorCode::from(e)), |
| 70 | } |
no test coverage detected