-
Notifications
You must be signed in to change notification settings - Fork 48
Minor code cleanup and modernization #305
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
This also moves the responsibility of reading from the file to the BufferHolder. This seems to make the responsibilities a bit clearer, although I also method on the buffers could work.
This introduces some breaking changes due to the accessor method naming pattern.
I realize this is contentious among some Java programmers, but given that most people modifying this code will be familiar with this pattern from other languages (Go, C#, etc.), this seems like an improvement.
This is easiest to review commit by commit. |
} | ||
|
||
for (ByteBuffer buffer : buffers) { | ||
channel.read(buffer); |
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.
Probably unnecessary, but would we want to have similar checks that we read the expected amount as in the non-test code?
+ this.ipVersion + ", nodeCount=" + this.nodeCount | ||
+ ", recordSize=" + this.recordSize + "]"; | ||
long searchTreeSize() { | ||
return nodeCount * nodeByteSize(); |
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 was calculated once before and just returned, whereas now we run this (and the above one) every time, right? Is that okay? I think there's a Network method in the same position.
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.
The Network
method was an intentional compromise. The previous lazy loading had race conditions and it didn't seem that beneficial. This one would probably make sense to calculate only once though.
They were not public and are used in hot paths.
In preparation for a major release.