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)
| 47 | /// Centralizing this avoids scattered `match` arms when new write variants |
| 48 | /// are added. Reads, scans, and query operators return `false`. |
| 49 | pub 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, |
no outgoing calls
no test coverage detected