Build a composite key from individual field values. Values are concatenated with `\0` separator. This preserves lexicographic ordering for prefix scans on leading fields. Limitation:** field values must not contain null bytes (`\0`), as they are used as separators. This holds for typical KV keys (strings, UUIDs, integers encoded as big-endian bytes).
(values: &[&[u8]])
| 156 | /// are used as separators. This holds for typical KV keys (strings, UUIDs, |
| 157 | /// integers encoded as big-endian bytes). |
| 158 | fn build_key(values: &[&[u8]]) -> Vec<u8> { |
| 159 | let mut key = Vec::new(); |
| 160 | for (i, v) in values.iter().enumerate() { |
| 161 | if i > 0 { |
| 162 | key.push(0); // Null separator. |
| 163 | } |
| 164 | key.extend_from_slice(v); |
| 165 | } |
| 166 | key |
| 167 | } |
| 168 | |
| 169 | /// Insert a composite entry. |
| 170 | pub fn insert(&mut self, field_values: &[&[u8]], primary_key: Vec<u8>) { |