Handle a single delta message from a Lite peer.
(
&self,
msg: &ArrayDeltaMsg,
)
| 160 | |
| 161 | /// Handle a single delta message from a Lite peer. |
| 162 | pub async fn handle_delta( |
| 163 | &self, |
| 164 | msg: &ArrayDeltaMsg, |
| 165 | ) -> Result<InboundOutcome, Option<ArrayRejectMsg>> { |
| 166 | let op = match op_codec::decode_op(&msg.op_payload) { |
| 167 | Ok(op) => op, |
| 168 | Err(e) => { |
| 169 | warn!(array = %msg.array, error = %e, "array_inbound: delta decode failed"); |
| 170 | return Err(Some(build_reject( |
| 171 | &msg.array, |
| 172 | Hlc::ZERO, |
| 173 | ArrayRejectReason::ShapeInvalid, |
| 174 | format!("decode error: {e}"), |
| 175 | ))); |
| 176 | } |
| 177 | }; |
| 178 | |
| 179 | self.apply_op(op, &msg.op_payload).await |
| 180 | } |
| 181 | |
| 182 | /// Handle a batch of delta messages from a Lite peer. |
| 183 | /// |