Skip to content
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 Struct::Status in Ruby #19939

Merged
merged 1 commit into from
Aug 16, 2019
Merged

Conversation

blowmage
Copy link
Contributor

This change defines Struct::Status in Ruby instead of in grpc_c. This corrects an issue with GRPC::BadStatus still depending on grpc_c that was discussed in #19893 (comment).

@apolcyn
Copy link
Contributor

apolcyn commented Aug 14, 2019

1.24 release blocker (not 1.23)

return nil if binstatus.nil?

# Lazily load grpc_c and protobuf_c.so for users of this method.
require_relative './grpc'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I think we can remove the corresponding logic from the caller of this in errors.rb

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Updated.

@@ -15,6 +15,7 @@
ssl_roots_path = File.expand_path('../../../../etc/roots.pem', __FILE__)

require_relative 'grpc/errors'
require_relative 'grpc/structs'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: requiring this is redundant?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly, but if other Structs are moved to Ruby then they should be loaded before grpc_c. I put the require here to be explicit about it.

@blowmage
Copy link
Contributor Author

@apolcyn Would you like me to squash the commits?

@@ -12,9 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

require_relative './grpc'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: though perhaps redundant, require structs here, since this file uses that type

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Added.

@@ -57,9 +59,6 @@ def to_status
#
# @return [Google::Rpc::Status, nil]
def to_rpc_status
# Lazily require google_rpc_status_utils to scope
# loading protobuf_c.so to the users of this method.
require_relative './google_rpc_status_utils'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: it's outside of the scope of this PR, but while we're here, can we also remove the two lines below here: I believe they are dead/unused code.

E.g. this could be change to just GoogleRpcStatusUtils.extract_google_rpc_status(to_status)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I've made this change and the end2end script continues to pass.

Copy link
Contributor

@apolcyn apolcyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but with two remaining nits. Please squash down commits too, thanks

Update error end2end test for loading when calling to_status.
Update error end2end test for loading when calling to_rpc_status.
@apolcyn apolcyn added the release notes: yes Indicates if PR needs to be in release notes label Aug 16, 2019
@apolcyn apolcyn merged commit 79fc2e5 into grpc:master Aug 16, 2019
@blowmage
Copy link
Contributor Author

Thanks!

@lock lock bot locked as resolved and limited conversation to collaborators Nov 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lang/ruby priority/P0/RELEASE BLOCKER release notes: yes Indicates if PR needs to be in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants