Construct a composite key for the expiry wheel: "{tenant_id}:{collection}\0{key_bytes}". The null byte separator is safe because collection names can't contain null.
(tenant_id: u64, collection: &str, key: &[u8])
| 14 | /// Construct a composite key for the expiry wheel: "{tenant_id}:{collection}\0{key_bytes}". |
| 15 | /// The null byte separator is safe because collection names can't contain null. |
| 16 | pub(super) fn expiry_key(tenant_id: u64, collection: &str, key: &[u8]) -> Vec<u8> { |
| 17 | let prefix = format!("{tenant_id}:{collection}\0"); |
| 18 | let mut composite = prefix.into_bytes(); |
| 19 | composite.extend_from_slice(key); |
| 20 | composite |
| 21 | } |
| 22 | |
| 23 | /// Parse a composite expiry key back into (tenant_id, collection, key_bytes). |
| 24 | pub(super) fn parse_expiry_key(composite: &[u8]) -> Option<(u64, String, Vec<u8>)> { |
no outgoing calls
no test coverage detected