-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Define Ruby Struct classes under GRPC::Core:: #19931
Define Ruby Struct classes under GRPC::Core:: #19931
Conversation
These classes are currently defined under Struct::
def to_status | ||
Struct::Status.new(code, details, metadata) | ||
GRPC::Core::Status.new(code, details, metadata) |
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 don't think changing the Status
module will work for backwards compatibility reasons. Note that while NewServerRpc
and BatchResult
are relatively internal objects, Struct::Status
is a part of the public surface API.
Can we solve the problem in #19893 (comment) by just moving the definition of Status
out of the C extension?
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.
What about moving the definition and then aliasing the old name to the new name?
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.
Though this would work, it's a slight complication - what's the motivation?
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 motivation is only that it looks like the intention would have been to locate these classes in the GRPC
namespace instead of using the default location under Struct
.
In Ruby I would expect an anonymous struct to be assigned to a constant:
GRPC::Core::Status = Struct.new(:code, :details, :metadata)
Instead of creating a named struct that uses the default location:
Struct.new('Status', :code, :details, :metadata) # Struct::Status
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 am happy to put this on pause and revisit it again once #19939 has been considered.
Noting this is a "release blocker" to make sure that the comment in #19893 (comment) is resolved before 1.24 (this isn't a 1.23 release blocker) |
FWIW, I think #19939 would be the release blocker, not this change. |
This issue/PR has been automatically marked as stale because it has not had any update (including commits, comments, labels, milestones, etc) for 180 days. It will be closed automatically if no further update occurs in 1 day. Thank you for your contributions! |
It looks like the intention was to define these classes under
GRPC::Core::
, but they are currently being defined underStruct::
(which is the default forrb_struct_define
).If you want this change to be 100% backwards compatible, we can also add the following aliases: