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

Method execute_recursive_scan

nodedb/src/data/executor/handlers/recursive.rs:28–288  ·  view source on GitHub ↗
(
        &mut self,
        task: &ExecutionTask,
        tid: u64,
        collection: &str,
        base_filters: &[u8],
        recursive_filters: &[u8],
        join_link: Option<&(String, String

Source from the content-addressed store, hash-verified

26 /// 5. Repeat until no new rows or max_iterations reached
27 #[allow(clippy::too_many_arguments)]
28 pub(in crate::data::executor) fn execute_recursive_scan(
29 &mut self,
30 task: &ExecutionTask,
31 tid: u64,
32 collection: &str,
33 base_filters: &[u8],
34 recursive_filters: &[u8],
35 join_link: Option<&(String, String)>,
36 max_iterations: usize,
37 distinct: bool,
38 limit: usize,
39 ) -> Response {
40 // Scan-quiesce gate.
41 let _scan_guard = match self.acquire_scan_guard(task, tid, collection) {
42 Ok(g) => g,
43 Err(resp) => return resp,
44 };
45
46 let scan_limit = self.query_tuning.aggregate_scan_cap;
47
48 // Parse filter predicates.
49 let base_preds: Vec<ScanFilter> = if base_filters.is_empty() {
50 Vec::new()
51 } else {
52 match zerompk::from_msgpack(base_filters) {
53 Ok(p) => p,
54 Err(e) => {
55 return self.response_error(
56 task,
57 ErrorCode::Internal {
58 detail: format!("base filter deserialization failed: {e}"),
59 },
60 );
61 }
62 }
63 };
64 let recursive_preds: Vec<ScanFilter> = if recursive_filters.is_empty() {
65 Vec::new()
66 } else {
67 match zerompk::from_msgpack(recursive_filters) {
68 Ok(p) => p,
69 Err(e) => {
70 return self.response_error(
71 task,
72 ErrorCode::Internal {
73 detail: format!("recursive filter deserialization failed: {e}"),
74 },
75 );
76 }
77 }
78 };
79
80 // Check if the collection uses strict (Binary Tuple) encoding.
81 let config_key = (crate::types::TenantId::new(tid), collection.to_string());
82 let strict_schema = self.doc_configs.get(&config_key).and_then(|c| {
83 if let nodedb_physical::physical_plan::StorageMode::Strict { ref schema } =
84 c.storage_mode
85 {

Callers 1

dispatch_queryMethod · 0.80

Calls 15

binary_tuple_to_msgpackFunction · 0.85
msgpack_to_json_stringFunction · 0.85
acquire_scan_guardMethod · 0.80
response_errorMethod · 0.80
to_stringMethod · 0.80
scan_documentsMethod · 0.80
matches_binaryMethod · 0.80
collectMethod · 0.80
response_with_payloadMethod · 0.80
extract_field_stringFunction · 0.70
json_to_msgpackFunction · 0.50
write_array_headerFunction · 0.50

Tested by

no test coverage detected