Parse the replica_id from the tail of a composite key.
(key: &[u8])
| 55 | |
| 56 | /// Parse the replica_id from the tail of a composite key. |
| 57 | fn replica_id_from_key(key: &[u8]) -> Option<u64> { |
| 58 | if key.len() < 9 { |
| 59 | return None; |
| 60 | } |
| 61 | let name_len = key[0] as usize; |
| 62 | let replica_start = 1 + name_len; |
| 63 | if key.len() < replica_start + 8 { |
| 64 | return None; |
| 65 | } |
| 66 | let bytes: [u8; 8] = key[replica_start..replica_start + 8].try_into().ok()?; |
| 67 | Some(u64::from_be_bytes(bytes)) |
| 68 | } |
| 69 | |
| 70 | /// Registry tracking the latest acknowledged HLC per `(array, replica_id)`. |
| 71 | /// |
no test coverage detected