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

Function is_write_plan

nodedb/src/control/planner/calvin/dispatch.rs:49–117  ·  view source on GitHub ↗

Returns `true` if the plan is a write operation. Centralizing this avoids scattered `match` arms when new write variants are added. Reads, scans, and query operators return `false`.

(plan: &PhysicalPlan)

Source from the content-addressed store, hash-verified

47/// Centralizing this avoids scattered `match` arms when new write variants
48/// are added. Reads, scans, and query operators return `false`.
49pub fn is_write_plan(plan: &PhysicalPlan) -> bool {
50 match plan {
51 // Document writes
52 PhysicalPlan::Document(op) => matches!(
53 op,
54 DocumentOp::PointPut { .. }
55 | DocumentOp::PointInsert { .. }
56 | DocumentOp::PointDelete { .. }
57 | DocumentOp::PointUpdate { .. }
58 | DocumentOp::BatchInsert { .. }
59 | DocumentOp::InsertSelect { .. }
60 | DocumentOp::Upsert { .. }
61 | DocumentOp::BulkUpdate { .. }
62 | DocumentOp::BulkDelete { .. }
63 | DocumentOp::UpdateFromJoin { .. }
64 ),
65 // KV writes
66 PhysicalPlan::Kv(op) => matches!(
67 op,
68 KvOp::Put { .. }
69 | KvOp::Insert { .. }
70 | KvOp::InsertIfAbsent { .. }
71 | KvOp::InsertOnConflictUpdate { .. }
72 | KvOp::Delete { .. }
73 | KvOp::BatchPut { .. }
74 ),
75 // Vector writes
76 PhysicalPlan::Vector(op) => matches!(
77 op,
78 VectorOp::Insert { .. }
79 | VectorOp::BatchInsert { .. }
80 | VectorOp::Delete { .. }
81 | VectorOp::DeleteBySurrogate { .. }
82 | VectorOp::SparseInsert { .. }
83 | VectorOp::SparseDelete { .. }
84 | VectorOp::MultiVectorInsert { .. }
85 ),
86 // Graph writes
87 PhysicalPlan::Graph(op) => {
88 matches!(op, GraphOp::EdgePut { .. } | GraphOp::EdgeDelete { .. })
89 }
90 // Timeseries writes
91 PhysicalPlan::Timeseries(op) => matches!(op, TimeseriesOp::Ingest { .. }),
92 // Columnar writes
93 PhysicalPlan::Columnar(op) => {
94 use nodedb_physical::physical_plan::ColumnarOp;
95 matches!(op, ColumnarOp::Insert { .. })
96 }
97 // CRDT writes
98 PhysicalPlan::Crdt(op) => {
99 use nodedb_physical::physical_plan::CrdtOp;
100 matches!(op, CrdtOp::ListInsert { .. } | CrdtOp::ListDelete { .. })
101 }
102 // Array writes
103 PhysicalPlan::Array(op) => {
104 use nodedb_physical::physical_plan::ArrayOp;
105 matches!(
106 op,

Callers 2

classify_dispatchFunction · 0.85
build_static_tx_classFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected