-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Expose non-nullable elements from slices of pointers #2200
Conversation
b8a3b1f
to
d2aa6cd
Compare
Codecov Report
@@ Coverage Diff @@
## master #2200 +/- ##
==========================================
+ Coverage 91.97% 92.15% +0.17%
==========================================
Files 271 271
Lines 15656 15269 -387
==========================================
- Hits 14400 14071 -329
+ Misses 854 824 -30
+ Partials 402 374 -28
Continue to review full report at Codecov.
|
d2aa6cd
to
b27910d
Compare
0acc0f3
to
e0d2934
Compare
e0d2934
to
81c3b9e
Compare
I do not quite understand the change. I see that you removed one level of indirection from the wrappers, but it is still not quite clear to me. Can you add a bit more details to the description? |
@tigrannajaryan PTAL, tried one more time :) |
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.
Mostly LGTM. Good change.
81c3b9e
to
72dd242
Compare
Currently for slices of pointers, pdata exposes elements that are pointers to the pointer in the slice (double pointers in the internal implementation). Because of this users have to deal with possible nil values, have to initialize elements (in some cases) etc, but in reality the elements in the slice cannot be nil, so this just adds extra unnecessary complexity. This is possible because: * Gogo proto (and protobuf) will not unmarshal any nil element in a slice; * Our APIs to add elements/remove elements from the slice will guarantee that we never have a nil element in the slice between [0, len-1]; This is an important change because will allow us to change the internal representation (use slice of pointers or non-pointers) without affecting the public API. Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
72dd242
to
4eeb597
Compare
@tigrannajaryan PTAL |
The changes are a result of removing IsNil, see open-telemetry/opentelemetry-collector#2200
…e but same timestamp (open-telemetry#2200)
Currently for slices of pointers, pdata exposes elements that are pointers to the pointer in the slice (double pointers in the internal implementation). Because of this users have to deal with possible
nil
values, have to initialize elements (in some cases) etc, but in reality the elements in the slice cannot benil
, so this just adds extra unnecessary complexity. This is possible because:Resize
orAppend
) will guarantee that we never have a nil element in the slice between [0, len-1]; ForAppend
by not allowing to create nil messages, we always append non-nil elements to the slice.This is an important change because will allow us to change the internal representation (use slice of pointers or non-pointers) without affecting the public API.
Signed-off-by: Bogdan Drutu bogdandrutu@gmail.com