(bytes: &[u8])
| 78 | } |
| 79 | |
| 80 | pub fn decode(bytes: &[u8]) -> PristineResult<Self> { |
| 81 | if bytes.len() <= KEY_HEADER_SIZE { |
| 82 | return Err(codec_error("FILE_INDEX_V2 key is truncated")); |
| 83 | } |
| 84 | if bytes[0] != FILE_INDEX_V2_KEY_VERSION { |
| 85 | return Err(codec_error(format!( |
| 86 | "unsupported FILE_INDEX_V2 key version {}", |
| 87 | bytes[0] |
| 88 | ))); |
| 89 | } |
| 90 | let working_copy = WorkingCopyId::from_bytes( |
| 91 | bytes[1..KEY_HEADER_SIZE] |
| 92 | .try_into() |
| 93 | .map_err(|_| codec_error("FILE_INDEX_V2 working-copy key is malformed"))?, |
| 94 | ); |
| 95 | Self::new(working_copy, bytes[KEY_HEADER_SIZE..].to_vec()) |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | /// Filesystem identity and canonical graph facts cached for one path. |
nothing calls this directly
no test coverage detected