Skip to content

Commit 9875e13

Browse files
committed
refactor: update engine dispatch and plan builders for serialisable plan types
Data plane dispatch (text, vector), enforcement, and engine handler modules are updated for the renamed/restructured plan types introduced by the PhysicalPlan serialisation work. Plan builders for graph, text, and vector native dispatch are aligned to the new type paths. Also update .gitignore for build artefacts introduced by the new gateway and startup modules.
1 parent 613131f commit 9875e13

10 files changed

Lines changed: 67 additions & 22 deletions

File tree

nodedb/src/control/server/native/dispatch/plan_builder/graph.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//! Graph operation plan builders.
22
3-
use std::sync::Arc;
4-
53
use nodedb_types::protocol::TextFields;
64
use sonic_rs;
75

@@ -22,7 +20,7 @@ pub(crate) fn build_rag_fusion(
2220
})?;
2321
Ok(PhysicalPlan::Graph(GraphOp::RagFusion {
2422
collection: collection.to_string(),
25-
query_vector: Arc::from(query_vector.as_slice()),
23+
query_vector: query_vector.clone(),
2624
vector_top_k: fields.vector_top_k.unwrap_or(20) as usize,
2725
edge_label: fields.edge_label.clone(),
2826
direction: parse_direction(fields.direction.as_deref()),

nodedb/src/control/server/native/dispatch/plan_builder/text.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//! Text search plan builders.
22
3-
use std::sync::Arc;
4-
53
use nodedb_types::protocol::TextFields;
64

75
use crate::bridge::envelope::PhysicalPlan;
@@ -49,7 +47,7 @@ pub(crate) fn build_hybrid_search(
4947

5048
Ok(PhysicalPlan::Text(TextOp::HybridSearch {
5149
collection: collection.to_string(),
52-
query_vector: Arc::from(query_vector.as_slice()),
50+
query_vector: query_vector.clone(),
5351
query_text: query_text.clone(),
5452
top_k,
5553
ef_search,

nodedb/src/control/server/native/dispatch/plan_builder/vector.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//! Vector engine plan builders.
22
3-
use std::sync::Arc;
4-
53
use nodedb_types::protocol::TextFields;
64

75
use crate::bridge::envelope::PhysicalPlan;
@@ -20,7 +18,7 @@ pub(crate) fn build_search(fields: &TextFields, collection: &str) -> crate::Resu
2018

2119
Ok(PhysicalPlan::Vector(VectorOp::Search {
2220
collection: collection.to_string(),
23-
query_vector: Arc::from(query_vector.as_slice()),
21+
query_vector: query_vector.clone(),
2422
top_k,
2523
ef_search,
2624
filter_bitmap: None,
@@ -93,7 +91,7 @@ pub(crate) fn build_multi_search(
9391

9492
Ok(PhysicalPlan::Vector(VectorOp::MultiSearch {
9593
collection: collection.to_string(),
96-
query_vector: Arc::from(query_vector.as_slice()),
94+
query_vector: query_vector.clone(),
9795
top_k,
9896
ef_search,
9997
filter_bitmap: None,

nodedb/src/data/executor/dispatch/text.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl CoreLoop {
4040
*ef_search,
4141
*fuzzy,
4242
*vector_weight,
43-
filter_bitmap.as_ref(),
43+
filter_bitmap.as_deref(),
4444
rls_filters,
4545
),
4646
}

nodedb/src/data/executor/dispatch/vector.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl CoreLoop {
4747
query_vector,
4848
top_k: *top_k,
4949
ef_search: *ef_search,
50-
filter_bitmap: filter_bitmap.as_ref(),
50+
filter_bitmap: filter_bitmap.as_deref(),
5151
rls_filters,
5252
},
5353
),
@@ -73,7 +73,7 @@ impl CoreLoop {
7373
query_vector,
7474
top_k: *top_k,
7575
ef_search: *ef_search,
76-
filter_bitmap: filter_bitmap.as_ref(),
76+
filter_bitmap: filter_bitmap.as_deref(),
7777
field_name,
7878
rls_filters,
7979
},

nodedb/src/data/executor/enforcement/retention.rs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,35 @@ pub fn check_delete_allowed(
4848
}
4949

5050
/// Parsed retention duration with calendar-accurate units.
51-
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
51+
#[derive(
52+
Debug,
53+
Clone,
54+
Copy,
55+
PartialEq,
56+
Eq,
57+
serde::Serialize,
58+
serde::Deserialize,
59+
zerompk::ToMessagePack,
60+
zerompk::FromMessagePack,
61+
)]
5262
pub struct RetentionDuration {
5363
pub count: u32,
5464
pub unit: RetentionUnit,
5565
}
5666

5767
/// Calendar-accurate duration units.
58-
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
68+
#[derive(
69+
Debug,
70+
Clone,
71+
Copy,
72+
PartialEq,
73+
Eq,
74+
serde::Serialize,
75+
serde::Deserialize,
76+
zerompk::ToMessagePack,
77+
zerompk::FromMessagePack,
78+
)]
79+
#[msgpack(c_enum)]
5980
pub enum RetentionUnit {
6081
Seconds,
6182
Minutes,

nodedb/src/data/executor/handlers/text_search.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl CoreLoop {
9292
ef_search: usize,
9393
fuzzy: bool,
9494
vector_weight: f32,
95-
filter_bitmap: Option<&std::sync::Arc<[u8]>>,
95+
filter_bitmap: Option<&[u8]>,
9696
rls_filters: &[u8],
9797
) -> Response {
9898
let scoped_coll = scoped_collection(tid, collection);

nodedb/src/data/executor/handlers/vector_search.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub(in crate::data::executor) struct VectorSearchParams<'a> {
5353
pub query_vector: &'a [f32],
5454
pub top_k: usize,
5555
pub ef_search: usize,
56-
pub filter_bitmap: Option<&'a std::sync::Arc<[u8]>>,
56+
pub filter_bitmap: Option<&'a [u8]>,
5757
pub field_name: &'a str,
5858
/// RLS post-candidate filters. Applied after HNSW/IVF returns candidates.
5959
pub rls_filters: &'a [u8],
@@ -67,7 +67,7 @@ pub(in crate::data::executor) struct VectorMultiSearchParams<'a> {
6767
pub query_vector: &'a [f32],
6868
pub top_k: usize,
6969
pub ef_search: usize,
70-
pub filter_bitmap: Option<&'a std::sync::Arc<[u8]>>,
70+
pub filter_bitmap: Option<&'a [u8]>,
7171
/// RLS post-candidate filters (evaluated per-candidate after RRF fusion).
7272
pub rls_filters: &'a [u8],
7373
}
@@ -186,7 +186,7 @@ impl CoreLoop {
186186
ivf: &crate::engine::vector::ivf::IvfPqIndex,
187187
query_vector: &[f32],
188188
top_k: usize,
189-
filter_bitmap: Option<&std::sync::Arc<[u8]>>,
189+
filter_bitmap: Option<&[u8]>,
190190
) -> Response {
191191
if ivf.is_empty() {
192192
return self.response_with_payload(task, b"[]".to_vec());

nodedb/src/engine/graph/algo/params.rs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,19 @@ use serde::{Deserialize, Serialize};
1111
/// Each variant maps to a standalone algorithm implementation under
1212
/// `src/engine/graph/algo/`. Used by `PhysicalPlan::GraphAlgo` to
1313
/// identify which algorithm to dispatch.
14-
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
14+
#[derive(
15+
Debug,
16+
Clone,
17+
Copy,
18+
PartialEq,
19+
Eq,
20+
Hash,
21+
Serialize,
22+
Deserialize,
23+
zerompk::ToMessagePack,
24+
zerompk::FromMessagePack,
25+
)]
26+
#[msgpack(c_enum)]
1527
pub enum GraphAlgorithm {
1628
/// PageRank — link analysis (power iteration).
1729
PageRank,
@@ -110,7 +122,16 @@ pub enum AlgoColumnType {
110122
/// Each algorithm validates and extracts the parameters it needs,
111123
/// ignoring the rest. Unknown parameters are silently ignored rather
112124
/// than rejected — this allows forward-compatible DDL extensions.
113-
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
125+
#[derive(
126+
Debug,
127+
Clone,
128+
Default,
129+
PartialEq,
130+
Serialize,
131+
Deserialize,
132+
zerompk::ToMessagePack,
133+
zerompk::FromMessagePack,
134+
)]
114135
pub struct AlgoParams {
115136
/// Target collection name.
116137
pub collection: String,

nodedb/src/engine/graph/traversal_options.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,16 @@ use serde::{Deserialize, Serialize};
99
///
1010
/// Controls fan-out limits, partial result handling, and visited node caps
1111
/// for scatter-gather graph queries across shards.
12-
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
12+
#[derive(
13+
Debug,
14+
Clone,
15+
PartialEq,
16+
Eq,
17+
Serialize,
18+
Deserialize,
19+
zerompk::ToMessagePack,
20+
zerompk::FromMessagePack,
21+
)]
1322
pub struct GraphTraversalOptions {
1423
/// Soft warning threshold (shards per hop).
1524
///

0 commit comments

Comments
 (0)