-
Notifications
You must be signed in to change notification settings - Fork 34
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
feat: snappy framing format #543
Conversation
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.
Good work!
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.
Left some more comments
Also, since CRC-32 checksums seem to be supported by the erlang stdlib, we could add checksum checking in this PR (should be just a call to CRC-32 and a comparison). |
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.
Hello Akash, here are some code quality and bug related comments. They still don't fully fix the problem though. You need to keep debugging. I suggest you do some of the following:
- Check if the masking works. Create a simple 32-bit element, like <<1, 0, 2, 0>>. Think how that would work when masked. That is, follow the rotation and then the addition, by hand (e.g. in a piece of paper). Then, check that your mask function does the same.
- Check with a different implementation, like lighthouse or lodestar, if their implementation of checksums computes the same checksum given the same payload. If they are different we might need to configure something in our crc32 call.
Don't hesitate on printing intermediate results both here and on the other implementation.
# test "decompress Ping responses" do | ||
# for {msg, expected} <- [ | ||
# {"0008FF060000734E61507059010C0000B18525A04300000000000000", "4300000000000000"}, | ||
# {"0008FF060000734E61507059010C00000175DE410100000000000000", "0100000000000000"}, | ||
# {"0008FF060000734E61507059010C0000EAB2043E0500000000000000", "0500000000000000"}, | ||
# {"0008FF060000734E61507059010C0000290398070000000000000000", "0000000000000000"} | ||
# ] do | ||
# "00" <> "08" <> compressed_payload = msg | ||
# expected = Base.decode16!(expected) | ||
|
||
# assert_snappy_decompress_frames(compressed_payload, expected) | ||
# end | ||
|
||
# # Error response | ||
# msg = | ||
# "011CFF060000734E6150705900220000EF99F84B1C6C4661696C656420746F20756E636F6D7072657373206D657373616765" | ||
|
||
# "01" <> "1C" <> compressed_payload = msg | ||
|
||
# assert_snappy_decompress_frames( | ||
# compressed_payload, | ||
# "Failed to uncompress message" | ||
# ) | ||
# end |
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.
Do these work?
Co-authored-by: Tomás Grüner <47506558+MegaRedHand@users.noreply.github.com>
Co-authored-by: Tomás Grüner <47506558+MegaRedHand@users.noreply.github.com>
Co-authored-by: Tomás Grüner <47506558+MegaRedHand@users.noreply.github.com>
Closing this since Akash is no longer in the bootcamp. Will link this PR to the issue though since there is some good work that has been done. |
Motivation
Implements the snappy decompression for the framing format.
Closes #224