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
Favor ByteBuf Duplicates, NettyJsonContentAuthSigner and StreamChannelConnectionCaptureSerializer Refactoring #615
Favor ByteBuf Duplicates, NettyJsonContentAuthSigner and StreamChannelConnectionCaptureSerializer Refactoring #615
Changes from 16 commits
66f9e58
3d28553
4bf9a0f
e2d7aaf
05271b2
daf2b23
7943c26
5afd1a0
bcc1c97
578cb0b
171dea0
9f78caf
8bc47ca
7fbd7a5
1b66165
0325b24
61dbc8f
7b270fa
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.
@gregschohn, added, depended on, and tested pessimisticallyCalculateMaxWritableSpace instead of calculateMaxWritableSpace
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.
This function calculates the max bytes that I could write to a protobuf stream, including the overhead to write the array, right? I'm thinking something like "calculateMaxArrayLengthForSpace" - something that indicates that exactly one piece of overhead is taken into account here, not the tag, no omission of the length. A clearer name (as hard as that is) will make this definition (which is now really easy to understand, thanks) and its applications more obvious.
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'm thinking
computeMaxLengthDelimitedFieldSizeForSpace
which is analogous to (internal method)computeLengthDelimitedFieldSize
in CodedOutputStreamThere 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 would roll this comment so that it's after the next two code lines
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.
woohoo! No more nioBuffer() call!
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.
Why is this taking the current buf into account? If we can write a fixed number of bytes (1?) in the next observation, won't we proceed with a partial? If we can't write an observation, we'll move on. Why do we need the initial size?
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'm not sure if this comment is still valid. See the one two earlier.
rename to something more like overheadAvailableForRestOfTrafficStreamAfterAddingBuf? As it is, it feels like this is more for what we need for a trafficStream.
A comment with a schematic and labels might help. e.g.
That isn't even quite right, but my hope is that if you have things really clearly defined and labeled, we might be able to come up with some conventions for how to define different computed values.
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.
nit, you could duplicate before the branch since both branches need it
Check warning on line 535 in TrafficCapture/captureOffloader/src/main/java/org/opensearch/migrations/trafficcapture/StreamChannelConnectionCaptureSerializer.java
Codecov / codecov/patch
TrafficCapture/captureOffloader/src/main/java/org/opensearch/migrations/trafficcapture/StreamChannelConnectionCaptureSerializer.java#L535
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.
nit - this could be a one-liner with the help of Arrays
Check warning on line 537 in TrafficCapture/captureOffloader/src/main/java/org/opensearch/migrations/trafficcapture/StreamChannelConnectionCaptureSerializer.java
Codecov / codecov/patch
TrafficCapture/captureOffloader/src/main/java/org/opensearch/migrations/trafficcapture/StreamChannelConnectionCaptureSerializer.java#L537
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.
This value is incorrect - you need to accumulate the sizes and return the bytes written...
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!
Check warning on line 542 in TrafficCapture/captureOffloader/src/main/java/org/opensearch/migrations/trafficcapture/StreamChannelConnectionCaptureSerializer.java
Codecov / codecov/patch
TrafficCapture/captureOffloader/src/main/java/org/opensearch/migrations/trafficcapture/StreamChannelConnectionCaptureSerializer.java#L542
Check warning on line 547 in TrafficCapture/captureOffloader/src/main/java/org/opensearch/migrations/trafficcapture/StreamChannelConnectionCaptureSerializer.java
Codecov / codecov/patch
TrafficCapture/captureOffloader/src/main/java/org/opensearch/migrations/trafficcapture/StreamChannelConnectionCaptureSerializer.java#L547
Check warning on line 552 in TrafficCapture/captureOffloader/src/main/java/org/opensearch/migrations/trafficcapture/StreamChannelConnectionCaptureSerializer.java
Codecov / codecov/patch
TrafficCapture/captureOffloader/src/main/java/org/opensearch/migrations/trafficcapture/StreamChannelConnectionCaptureSerializer.java#L552
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.
why would you penalize somebody for calling close()? It's more future-proof to just leave this as a noop