Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please note that this PR is dependent upon #111 -- a separate PR to isolate the changes to the
spec.md
file, removing the trailing whitespace that affects edits of that file.This patch updates the VolumeHandle message with a new, required field -
checksum
- an MD5 checksum of the handle's ID and metadata (keys sorted lexicographically).Value
A checksum for the handle provides both data integrity and a single, small, unique piece of data that can be used to quickly cache and retrieve volume information based on a handle. The handle's ID cannot be used for this purpose as the ID alone does not guarantee uniqueness.
Overhead
Because the checksums produced by the MD5 algorithm are 32 bytes in size, the checksum data does not add much overhead to the handle itself, easily allowing handles to stay within the suggested constraint of 1MiB.
Calculation
The checksum should be calculated by writing the handle's ID to a buffer followed by writing the metadata's key/value pairs to the same buffer where the keys are sorted lexicographically.
For example, take the following handle:
The buffer used to calculate the checksum for the above handle is:
The MD5 checksum for the above handle is therefore: