| 388 | } |
| 389 | |
| 390 | fn encode_msgpack_array(rows: &[Vec<u8>]) -> Vec<u8> { |
| 391 | let total_data: usize = rows.iter().map(|row| row.len()).sum(); |
| 392 | let mut out = Vec::with_capacity(total_data + 5); |
| 393 | |
| 394 | let row_count = rows.len(); |
| 395 | if row_count < 16 { |
| 396 | out.push(0x90 | row_count as u8); |
| 397 | } else if row_count <= u16::MAX as usize { |
| 398 | out.push(0xdc); |
| 399 | out.extend_from_slice(&(row_count as u16).to_be_bytes()); |
| 400 | } else { |
| 401 | out.push(0xdd); |
| 402 | out.extend_from_slice(&(row_count as u32).to_be_bytes()); |
| 403 | } |
| 404 | |
| 405 | for row in rows { |
| 406 | out.extend_from_slice(row); |
| 407 | } |
| 408 | out |
| 409 | } |
| 410 | |
| 411 | /// Broadcast a `DocumentOp::Register` plan to **every** Data Plane core |
| 412 | /// and await an acknowledgement from each core before returning. |