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

Method execute_point_update

nodedb/src/data/executor/handlers/point/update.rs:23–324  ·  view source on GitHub ↗
(
        &mut self,
        task: &ExecutionTask,
        tid: u64,
        collection: &str,
        document_id: &str,
        surrogate: Surrogate,
        updates: &[(String, UpdateValue)],
     

Source from the content-addressed store, hash-verified

21impl CoreLoop {
22 #[allow(clippy::too_many_arguments)]
23 pub(in crate::data::executor) fn execute_point_update(
24 &mut self,
25 task: &ExecutionTask,
26 tid: u64,
27 collection: &str,
28 document_id: &str,
29 surrogate: Surrogate,
30 updates: &[(String, UpdateValue)],
31 returning: Option<&ReturningSpec>,
32 ) -> Response {
33 let row_key = surrogate_to_doc_id(surrogate);
34 let row_key = row_key.as_str();
35 debug!(
36 core = self.core_id,
37 %collection,
38 %document_id,
39 fields = updates.len(),
40 has_returning = returning.is_some(),
41 "point update"
42 );
43
44 let config_key = (crate::types::TenantId::new(tid), collection.to_string());
45 let is_strict = self.doc_configs.get(&config_key).is_some_and(|c| {
46 matches!(
47 c.storage_mode,
48 nodedb_physical::physical_plan::StorageMode::Strict { .. }
49 )
50 });
51
52 // Reject direct updates to generated columns.
53 if let Some(config) = self.doc_configs.get(&config_key)
54 && let Err(e) = super::super::generated::check_generated_readonly(
55 updates,
56 &config.enforcement.generated_columns,
57 )
58 {
59 return self.response_error(task, e);
60 }
61
62 // Any non-literal assignment forces the slow decode→eval→re-encode path,
63 // because we need the current document to evaluate against.
64 let has_expr = updates
65 .iter()
66 .any(|(_, v)| matches!(v, UpdateValue::Expr(_)));
67
68 let bitemporal = self.is_bitemporal(tid, collection);
69 let sys_from_for_encode = if bitemporal {
70 self.bitemporal_now_ms()
71 } else {
72 0
73 };
74 let get_result = if bitemporal {
75 self.sparse.versioned_get_current(tid, collection, row_key)
76 } else {
77 self.sparse.get(tid, collection, row_key)
78 };
79 match get_result {
80 Ok(Some(current_bytes)) => {

Callers 1

dispatch_documentMethod · 0.80

Calls 15

surrogate_to_doc_idFunction · 0.85
check_generated_readonlyFunction · 0.85
needs_recomputationFunction · 0.85
merge_fieldsFunction · 0.85
binary_tuple_to_jsonFunction · 0.85
decode_documentFunction · 0.85
json_from_msgpackFunction · 0.85
value_to_binary_tupleFunction · 0.85
encode_to_msgpackFunction · 0.85
inject_str_fieldFunction · 0.85

Tested by

no test coverage detected