(
&mut self,
task: &ExecutionTask,
tid: u64,
collection: &str,
src_id: &str,
label: &str,
dst_id: &str,
properties: &[u8],
src_s
| 32 | impl CoreLoop { |
| 33 | #[allow(clippy::too_many_arguments)] |
| 34 | pub(in crate::data::executor) fn execute_edge_put( |
| 35 | &mut self, |
| 36 | task: &ExecutionTask, |
| 37 | tid: u64, |
| 38 | collection: &str, |
| 39 | src_id: &str, |
| 40 | label: &str, |
| 41 | dst_id: &str, |
| 42 | properties: &[u8], |
| 43 | src_surrogate: nodedb_types::Surrogate, |
| 44 | dst_surrogate: nodedb_types::Surrogate, |
| 45 | ) -> Response { |
| 46 | debug!(core = self.core_id, tid, %collection, %src_id, %label, %dst_id, "edge put"); |
| 47 | |
| 48 | if self.is_node_deleted(tid, src_id) { |
| 49 | return self.response_error( |
| 50 | task, |
| 51 | ErrorCode::RejectedDanglingEdge { |
| 52 | missing_node: src_id.to_string(), |
| 53 | }, |
| 54 | ); |
| 55 | } |
| 56 | if self.is_node_deleted(tid, dst_id) { |
| 57 | return self.response_error( |
| 58 | task, |
| 59 | ErrorCode::RejectedDanglingEdge { |
| 60 | missing_node: dst_id.to_string(), |
| 61 | }, |
| 62 | ); |
| 63 | } |
| 64 | |
| 65 | let ord = self.hlc.next_ordinal(); |
| 66 | let valid_from_ms = nodedb_types::ordinal_to_ms(ord); |
| 67 | use crate::engine::graph::edge_store::EdgeRef; |
| 68 | match self.edge_store.put_edge_versioned( |
| 69 | EdgeRef::new(TenantId::new(tid), collection, src_id, label, dst_id), |
| 70 | properties, |
| 71 | ord, |
| 72 | valid_from_ms, |
| 73 | i64::MAX, |
| 74 | ) { |
| 75 | Ok(()) => { |
| 76 | let weight = crate::engine::graph::csr::extract_weight_from_properties(properties); |
| 77 | let partition = self.csr_partition_mut(tid); |
| 78 | let csr_result = if weight != 1.0 { |
| 79 | partition.add_edge_weighted(src_id, label, dst_id, weight) |
| 80 | } else { |
| 81 | partition.add_edge(src_id, label, dst_id) |
| 82 | }; |
| 83 | match csr_result { |
| 84 | Ok(()) => { |
| 85 | // Populate the per-node surrogates so future bitmap-gated |
| 86 | // traversals can check membership without a separate lookup. |
| 87 | partition.set_node_surrogate(src_id, src_surrogate); |
| 88 | partition.set_node_surrogate(dst_id, dst_surrogate); |
| 89 | self.checkpoint_coordinator.mark_dirty("sparse", 1); |
| 90 | self.response_ok(task) |
| 91 | } |
no test coverage detected