Build the key: `[name_len: u8][name bytes][replica_id: u64 BE]`.
(array: &str, replica_id: u64)
| 28 | |
| 29 | /// Build the key: `[name_len: u8][name bytes][replica_id: u64 BE]`. |
| 30 | fn ack_key(array: &str, replica_id: u64) -> Option<Vec<u8>> { |
| 31 | let name_bytes = array.as_bytes(); |
| 32 | let name_len = u8::try_from(name_bytes.len()).ok()?; |
| 33 | let mut key = Vec::with_capacity(1 + name_bytes.len() + 8); |
| 34 | key.push(name_len); |
| 35 | key.extend_from_slice(name_bytes); |
| 36 | key.extend_from_slice(&replica_id.to_be_bytes()); |
| 37 | Some(key) |
| 38 | } |
| 39 | |
| 40 | /// Parse the array name from the head of a composite key. |
| 41 | /// |