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

Method evaluate_array_mutation

nodedb/src/control/server/sync/shape/registry.rs:198–220  ·  view source on GitHub ↗

Evaluate an array op against all active shapes. Returns a list of `(session_id, shape_id)` pairs for `ShapeType::Array` shapes that match the mutation. The caller then pushes `ArrayDeltaMsg` frames to the matching sessions. This is a sibling of [`evaluate_mutation`] rather than a refactor so that the existing document/vector matching path is not disturbed.

(
        &self,
        tenant_id: u64,
        array_name: &str,
        coord: &[u64],
    )

Source from the content-addressed store, hash-verified

196 /// This is a sibling of [`evaluate_mutation`] rather than a refactor so
197 /// that the existing document/vector matching path is not disturbed.
198 pub fn evaluate_array_mutation(
199 &self,
200 tenant_id: u64,
201 array_name: &str,
202 coord: &[u64],
203 ) -> Vec<(String, ShapeId)> {
204 let sessions =
205 crate::control::lock_utils::read_or_recover(self.sessions.read(), "shape_sessions");
206 let mut matches = Vec::new();
207
208 for (session_id, client) in sessions.iter() {
209 if client.tenant_id != tenant_id {
210 continue;
211 }
212 for (shape_id, shape) in &client.shapes {
213 if shape.matches_array_op(array_name, coord) {
214 matches.push((session_id.clone(), shape_id.clone()));
215 }
216 }
217 }
218
219 matches
220 }
221
222 /// Get a shape definition by session + shape_id.
223 pub fn get_shape(&self, session_id: &str, shape_id: &str) -> Option<ShapeDefinition> {

Calls 6

read_or_recoverFunction · 0.85
matches_array_opMethod · 0.80
readMethod · 0.45
iterMethod · 0.45
pushMethod · 0.45
cloneMethod · 0.45