-
Notifications
You must be signed in to change notification settings - Fork 231
Support CRC32 validation for both RAFS V5 and V6. #1670
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
b34dc5d
to
631049c
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1670 +/- ##
==========================================
+ Coverage 55.31% 55.34% +0.03%
==========================================
Files 196 197 +1
Lines 55347 55706 +359
Branches 46817 47176 +359
==========================================
+ Hits 30614 30833 +219
- Misses 23143 23273 +130
- Partials 1590 1600 +10
🚀 New features to boost your workflow:
|
builder/src/chunkdict_generator.rs
Outdated
@@ -270,6 +270,7 @@ impl Generator { | |||
chunk.set_uncompressed_size(chunk_info.chunk_uncompressed_size); | |||
chunk.set_uncompressed_offset(chunk_info.chunk_uncompressed_offset); | |||
chunk.set_id(RafsDigest::from_string(&chunk_info.chunk_digest)); | |||
// TODO: set crc32 of chunk. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add it now?
builder/src/core/node.rs
Outdated
@@ -337,6 +337,10 @@ impl Node { | |||
external_compressed_offset += compressed_size as u64; | |||
external_blob_ctx.chunk_size = external_chunk_size as u32; | |||
|
|||
if ctx.crc_checker != crc::Algorithm::None { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
crc_checker
-> crc_algorithm
rafs/src/metadata/layout/v6.rs
Outdated
@@ -583,6 +583,15 @@ impl RafsV6SuperBlockExt { | |||
self.s_flags |= c.bits(); | |||
} | |||
|
|||
/// Set CRC algorithm to handle chunk of the Rafs filesystem. | |||
pub fn set_crc_checker(&mut self, crc_algo: crc::Algorithm) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set_crc_algorithm
- Add CRC32 algorithm implementation wiht crc-rs crate. - Introduced a crc_enable option to the nydus builder. - Support for generating CRC32 checksums when building images. - Support for validating CRC32 in both normal chunk or external chunks. Signed-off-by: Yang Kaiyong <yangkaiyong.yky@antgroup.com>
cfb2067
to
3e56b46
Compare
Signed-off-by: Yang Kaiyong <yangkaiyong.yky@antgroup.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, others LGTM!
Relevant Issue (if applicable)
If there are Issues related to this PullRequest, please list it.
Details
Please describe the details of PullRequest.
In P2P transmission, errors in the pulled Chunk information may occur due to network issues or other reasons. To address this, CRC32 has been introduced to verify the integrity of Chunk data. Compared to the case without enabling verification, using CRC32 increases the processing time by approximately 5.6%, which is an acceptable overhead.
Types of changes
What types of changes does your PullRequest introduce? Put an
x
in all the boxes that apply:Checklist
Go over all the following points, and put an
x
in all the boxes that apply.