When data is being stored remotely, the checksums file (containing hashes
for all the segments needed by a snapshot) may only be stored locally for a
short period of time. We can't wait to compute its checksum (for inclusion
into the root descriptor) until the time when the root descriptor is
writtenout, since the checksum file may be gone by then.
Compute the checksum earlier (before sending the checksums file to remote
storage), and save the checksum value until it is written out later.
}
}
fclose(checksums);
+
+ SHA1Checksum checksum_csum;
+ string csum;
+ checksum_filename = checksum_file->get_local_path();
+ if (checksum_csum.process_file(checksum_filename.c_str())) {
+ csum = checksum_csum.checksum_str();
+ }
+
checksum_file->send();
db->Close();
fprintf(descriptor, "Backup-Intent: %g\n", snapshot_intent);
fprintf(descriptor, "Root: %s\n", backup_root.c_str());
- SHA1Checksum checksum_csum;
- if (checksum_csum.process_file(checksum_filename.c_str())) {
- string csum = checksum_csum.checksum_str();
+ if (csum.size() > 0) {
fprintf(descriptor, "Checksums: %s\n", csum.c_str());
}