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

Method handle_delta_batch

nodedb/src/control/array_sync/inbound.rs:186–207  ·  view source on GitHub ↗

Handle a batch of delta messages from a Lite peer. Returns one outcome per op. If decoding fails for an op, that op yields a reject; subsequent ops are still attempted.

(
        &self,
        msg: &ArrayDeltaBatchMsg,
    )

Source from the content-addressed store, hash-verified

184 /// Returns one outcome per op. If decoding fails for an op, that op
185 /// yields a reject; subsequent ops are still attempted.
186 pub async fn handle_delta_batch(
187 &self,
188 msg: &ArrayDeltaBatchMsg,
189 ) -> Vec<Result<InboundOutcome, Option<ArrayRejectMsg>>> {
190 let mut outcomes = Vec::with_capacity(msg.op_payloads.len());
191 for payload in &msg.op_payloads {
192 let outcome = match op_codec::decode_op(payload) {
193 Ok(op) => self.apply_op(op, payload).await,
194 Err(e) => {
195 warn!(array = %msg.array, error = %e, "array_inbound: batch decode failed");
196 Err(Some(build_reject(
197 &msg.array,
198 Hlc::ZERO,
199 ArrayRejectReason::ShapeInvalid,
200 format!("batch decode error: {e}"),
201 )))
202 }
203 };
204 outcomes.push(outcome);
205 }
206 outcomes
207 }
208
209 // ─── Schema ──────────────────────────────────────────────────────────────
210

Callers 1

dispatch_array_frameFunction · 0.80

Calls 5

decode_opFunction · 0.85
build_rejectFunction · 0.85
apply_opMethod · 0.80
lenMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected