Build the composite key: `[name_len: u8][name bytes][hlc: 18 bytes]`.
(array: &str, hlc: Hlc)
| 31 | |
| 32 | /// Build the composite key: `[name_len: u8][name bytes][hlc: 18 bytes]`. |
| 33 | fn snapshot_key(array: &str, hlc: Hlc) -> Option<Vec<u8>> { |
| 34 | let name_bytes = array.as_bytes(); |
| 35 | let name_len = u8::try_from(name_bytes.len()).ok()?; |
| 36 | let mut key = Vec::with_capacity(1 + name_bytes.len() + 18); |
| 37 | key.push(name_len); |
| 38 | key.extend_from_slice(name_bytes); |
| 39 | key.extend_from_slice(&hlc.to_bytes()); |
| 40 | Some(key) |
| 41 | } |
| 42 | |
| 43 | /// Build the name-prefix used for range scans: `[name_len: u8][name bytes]`. |
| 44 | fn name_prefix(array: &str) -> Option<Vec<u8>> { |