Function compare_digests

Source
fn compare_digests(
    mtree: &Mtree,
    input_dir: &InputDir,
    file_name: &str,
) -> Result<(PathBuf, Vec<u8>), Error>
Expand description

Compares the hash digest of a file with the recorded data in an Mtree.

Takes an mtree against which a file_name in input_dir is checked. Returns the absolute path to the file and a byte buffer that represents the contents of the file.

ยงErrors

Returns an error if

  • the file path (input_dir + file_name) does not exist,
  • the file can not be read,
  • the hash digest of the file does not match that initially recorded in mtree,
  • or the file can not be found in mtree.