Parse the HLC from the tail of a composite key. Returns `None` if the key is shorter than `prefix_len + 18`.
(key: &[u8], prefix_len: usize)
| 51 | /// |
| 52 | /// Returns `None` if the key is shorter than `prefix_len + 18`. |
| 53 | fn hlc_from_key(key: &[u8], prefix_len: usize) -> Option<Hlc> { |
| 54 | if key.len() < prefix_len + 18 { |
| 55 | return None; |
| 56 | } |
| 57 | let start = key.len() - 18; |
| 58 | let hlc_bytes: [u8; 18] = key[start..].try_into().ok()?; |
| 59 | Some(Hlc::from_bytes(&hlc_bytes)) |
| 60 | } |
| 61 | |
| 62 | /// Persistent array op-log backed by a dedicated redb database. |
| 63 | /// |
no test coverage detected