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.
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
CASSGO-1 CASSGO-30 Native Protocol 5 Support #1822
base: trunk
Are you sure you want to change the base?
CASSGO-1 CASSGO-30 Native Protocol 5 Support #1822
Changes from 7 commits
fbdaa2b
93fb4ad
d926108
a1baea2
b77aa18
465332b
f613eaa
380d660
8b7e64b
2eb3fbe
7a210f2
d8ab2fa
34db5ed
df5adc0
a79c985
86130c0
1343003
98e37c1
31d10f9
2a5056d
bf0d7fa
0592a90
0298a00
a1a613c
e779e73
5ca5382
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Could you please add doc comment describing the semantics of the method?
We could also change this to be append-like, as follows:
It seems that would be more flexible, for example it would allow the framer to reuse buffers for decompression in a sync.Pool if needed. And since this will be in 2.0, we could adjust the other methods as well.
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.
I agree with this, it's a great suggestion 👍 We don't have to work on changing the framer to reuse buffers now but making the API change now on the 2.0 release would make the most sense.
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.
Then we should agree on the API.
We could adjust the current API to this:
As another solution, we could change the API to this:
The second provides distinguishing methods for:
EncodeWithSize
andDecodeWithSize
Encode
andDecode
.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.
To truly make it 100% "append-like" (examples: golang/go#53693):
The lz4 library does not support append like semantics so we're going to have to expand
dst
slice before passing it to the lz4 library functions. Ifcap(dst)-len(dst)
is not large enough then we'll have to allocate a new byte slice and append it todst
instead.AppendDecompressed
has thedecompressedLength
parameter so we can check if we can reusedst
or if we have to allocate a new byte slice.I used the name
Compress
andDecompress
instead ofEncode
/Decode
because it felt more natural to me but I'm fine with keepingEncode
andDecode
. Same forWithLength
/WithSize
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.
Could you please look at this? I tried to implement this append-like API, but I'm unsure if I should implement the
AppendCompressed
andAppendDecompressed
methods for our snappy wrapper...I like your variants. If nobody has anything against then I'll use them.
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.
Added a few comments but that's the spirit of what I was suggesting 👍 @martin-sucha can you also take a look to see if it is in line with what you were suggesting?
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.
I think it's fine to make them panic since protocol v5 doesn't support snappy anyway.
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.
I added the suggested by @joao-r-reis solution. @martin-sucha Could you please take a look at this?