diff --git a/doc/health-checking.md b/doc/health-checking.md index 0b3f9c6a034..92512e942bd 100644 --- a/doc/health-checking.md +++ b/doc/health-checking.md @@ -26,7 +26,7 @@ The server should export a service defined in the following proto: ``` syntax = "proto3"; -package grpc.health.v1alpha; +package grpc.health.v1; message HealthCheckRequest { string service = 1; @@ -49,7 +49,7 @@ service Health { A client can query the server’s health status by calling the `Check` method, and a deadline should be set on the rpc. The client can optionally set the service name it wants to query for health status. The suggested format of service name -is `package_names.ServiceName`, such as `grpc.health.v1alpha.Health`. +is `package_names.ServiceName`, such as `grpc.health.v1.Health`. The server should register all the services manually and set the individual status, including an empty service name and its status. For each diff --git a/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.nuspec b/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.nuspec index 66386288df1..7b3b391009e 100644 --- a/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.nuspec +++ b/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.nuspec @@ -4,7 +4,7 @@ Grpc.HealthCheck gRPC C# Healthchecking Implementation of gRPC health service - Example implementation of grpc.health.v1alpha service that can be used for health-checking. + Example implementation of grpc.health.v1 service that can be used for health-checking. $version$ Google Inc. grpc-packages diff --git a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs index 882edd56270..68320eb5c2e 100644 --- a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs +++ b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs @@ -7,15 +7,15 @@ using System.Threading; using System.Threading.Tasks; using Grpc.Core; -namespace Grpc.Health.V1Alpha { +namespace Grpc.Health.V1 { public static class Health { - static readonly string __ServiceName = "grpc.health.v1alpha.Health"; + static readonly string __ServiceName = "grpc.health.v1.Health"; - static readonly Marshaller __Marshaller_HealthCheckRequest = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Health.V1Alpha.HealthCheckRequest.Parser.ParseFrom); - static readonly Marshaller __Marshaller_HealthCheckResponse = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Health.V1Alpha.HealthCheckResponse.Parser.ParseFrom); + static readonly Marshaller __Marshaller_HealthCheckRequest = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Health.V1.HealthCheckRequest.Parser.ParseFrom); + static readonly Marshaller __Marshaller_HealthCheckResponse = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Health.V1.HealthCheckResponse.Parser.ParseFrom); - static readonly Method __Method_Check = new Method( + static readonly Method __Method_Check = new Method( MethodType.Unary, __ServiceName, "Check", @@ -25,22 +25,22 @@ namespace Grpc.Health.V1Alpha { // service descriptor public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor { - get { return global::Grpc.Health.V1Alpha.HealthReflection.Descriptor.Services[0]; } + get { return global::Grpc.Health.V1.HealthReflection.Descriptor.Services[0]; } } // client interface public interface IHealthClient { - global::Grpc.Health.V1Alpha.HealthCheckResponse Check(global::Grpc.Health.V1Alpha.HealthCheckRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - global::Grpc.Health.V1Alpha.HealthCheckResponse Check(global::Grpc.Health.V1Alpha.HealthCheckRequest request, CallOptions options); - AsyncUnaryCall CheckAsync(global::Grpc.Health.V1Alpha.HealthCheckRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - AsyncUnaryCall CheckAsync(global::Grpc.Health.V1Alpha.HealthCheckRequest request, CallOptions options); + global::Grpc.Health.V1.HealthCheckResponse Check(global::Grpc.Health.V1.HealthCheckRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + global::Grpc.Health.V1.HealthCheckResponse Check(global::Grpc.Health.V1.HealthCheckRequest request, CallOptions options); + AsyncUnaryCall CheckAsync(global::Grpc.Health.V1.HealthCheckRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); + AsyncUnaryCall CheckAsync(global::Grpc.Health.V1.HealthCheckRequest request, CallOptions options); } // server-side interface public interface IHealth { - Task Check(global::Grpc.Health.V1Alpha.HealthCheckRequest request, ServerCallContext context); + Task Check(global::Grpc.Health.V1.HealthCheckRequest request, ServerCallContext context); } // client stub @@ -49,22 +49,22 @@ namespace Grpc.Health.V1Alpha { public HealthClient(Channel channel) : base(channel) { } - public global::Grpc.Health.V1Alpha.HealthCheckResponse Check(global::Grpc.Health.V1Alpha.HealthCheckRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + public global::Grpc.Health.V1.HealthCheckResponse Check(global::Grpc.Health.V1.HealthCheckRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { var call = CreateCall(__Method_Check, new CallOptions(headers, deadline, cancellationToken)); return Calls.BlockingUnaryCall(call, request); } - public global::Grpc.Health.V1Alpha.HealthCheckResponse Check(global::Grpc.Health.V1Alpha.HealthCheckRequest request, CallOptions options) + public global::Grpc.Health.V1.HealthCheckResponse Check(global::Grpc.Health.V1.HealthCheckRequest request, CallOptions options) { var call = CreateCall(__Method_Check, options); return Calls.BlockingUnaryCall(call, request); } - public AsyncUnaryCall CheckAsync(global::Grpc.Health.V1Alpha.HealthCheckRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) + public AsyncUnaryCall CheckAsync(global::Grpc.Health.V1.HealthCheckRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) { var call = CreateCall(__Method_Check, new CallOptions(headers, deadline, cancellationToken)); return Calls.AsyncUnaryCall(call, request); } - public AsyncUnaryCall CheckAsync(global::Grpc.Health.V1Alpha.HealthCheckRequest request, CallOptions options) + public AsyncUnaryCall CheckAsync(global::Grpc.Health.V1.HealthCheckRequest request, CallOptions options) { var call = CreateCall(__Method_Check, options); return Calls.AsyncUnaryCall(call, request); diff --git a/src/csharp/generate_proto_csharp.sh b/src/csharp/generate_proto_csharp.sh index 0261a458af7..23e0540253a 100755 --- a/src/csharp/generate_proto_csharp.sh +++ b/src/csharp/generate_proto_csharp.sh @@ -42,7 +42,7 @@ $PROTOC --plugin=$PLUGIN --csharp_out=$EXAMPLES_DIR --grpc_out=$EXAMPLES_DIR \ -I src/proto/math src/proto/math/math.proto $PROTOC --plugin=$PLUGIN --csharp_out=$HEALTHCHECK_DIR --grpc_out=$HEALTHCHECK_DIR \ - -I src/proto/grpc/health/v1alpha src/proto/grpc/health/v1alpha/health.proto + -I src/proto/grpc/health/v1 src/proto/grpc/health/v1/health.proto $PROTOC --plugin=$PLUGIN --csharp_out=$TESTING_DIR --grpc_out=$TESTING_DIR \ -I . src/proto/grpc/testing/{control,empty,messages,payloads,services,stats,test}.proto diff --git a/src/node/health_check/health.js b/src/node/health_check/health.js index 1a2c0366875..6ab41571831 100644 --- a/src/node/health_check/health.js +++ b/src/node/health_check/health.js @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,9 +38,9 @@ var grpc = require('../'); var _ = require('lodash'); var health_proto = grpc.load(__dirname + - '/../../proto/grpc/health/v1alpha/health.proto'); + '/../../proto/grpc/health/v1/health.proto'); -var HealthClient = health_proto.grpc.health.v1alpha.Health; +var HealthClient = health_proto.grpc.health.v1.Health; function HealthImplementation(statusMap) { this.statusMap = _.clone(statusMap); diff --git a/src/proto/grpc/health/v1alpha/health.proto b/src/proto/grpc/health/v1/health.proto similarity index 93% rename from src/proto/grpc/health/v1alpha/health.proto rename to src/proto/grpc/health/v1/health.proto index 05f837dd990..6e27606d1b6 100644 --- a/src/proto/grpc/health/v1alpha/health.proto +++ b/src/proto/grpc/health/v1/health.proto @@ -29,12 +29,11 @@ syntax = "proto3"; -package grpc.health.v1alpha; -option csharp_namespace = "Grpc.Health.V1Alpha"; +package grpc.health.v1; +option csharp_namespace = "Grpc.Health.V1"; message HealthCheckRequest { - string host = 1; - string service = 2; + string service = 1; } message HealthCheckResponse { diff --git a/src/python/grpcio_health_checking/grpc/health/v1alpha/__init__.py b/src/python/grpcio_health_checking/grpc/health/v1/__init__.py similarity index 97% rename from src/python/grpcio_health_checking/grpc/health/v1alpha/__init__.py rename to src/python/grpcio_health_checking/grpc/health/v1/__init__.py index 70865191060..13aac79160b 100644 --- a/src/python/grpcio_health_checking/grpc/health/v1alpha/__init__.py +++ b/src/python/grpcio_health_checking/grpc/health/v1/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2015, Google Inc. +# Copyright 2015-2016, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/src/python/grpcio_health_checking/grpc/health/v1alpha/health.proto b/src/python/grpcio_health_checking/grpc/health/v1/health.proto similarity index 96% rename from src/python/grpcio_health_checking/grpc/health/v1alpha/health.proto rename to src/python/grpcio_health_checking/grpc/health/v1/health.proto index 57f4aaa9c08..de10719b6ce 100644 --- a/src/python/grpcio_health_checking/grpc/health/v1alpha/health.proto +++ b/src/python/grpcio_health_checking/grpc/health/v1/health.proto @@ -1,4 +1,4 @@ -// Copyright 2015, Google Inc. +// Copyright 2015-2016, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ syntax = "proto3"; -package grpc.health.v1alpha; +package grpc.health.v1; message HealthCheckRequest { string service = 1; diff --git a/src/python/grpcio_health_checking/grpc/health/v1alpha/health.py b/src/python/grpcio_health_checking/grpc/health/v1/health.py similarity index 96% rename from src/python/grpcio_health_checking/grpc/health/v1alpha/health.py rename to src/python/grpcio_health_checking/grpc/health/v1/health.py index 9dfcd962f06..60cbd644330 100644 --- a/src/python/grpcio_health_checking/grpc/health/v1alpha/health.py +++ b/src/python/grpcio_health_checking/grpc/health/v1/health.py @@ -1,4 +1,4 @@ -# Copyright 2015, Google Inc. +# Copyright 2015-2016, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -33,7 +33,7 @@ import abc import enum import threading -from grpc.health.v1alpha import health_pb2 +from grpc.health.v1 import health_pb2 @enum.unique @@ -64,7 +64,7 @@ class _HealthServicer(health_pb2.EarlyAdopterHealthServicer): def set(service, status): if not isinstance(status, HealthStatus): - raise TypeError('expected grpc.health.v1alpha.health.HealthStatus ' + raise TypeError('expected grpc.health.v1.health.HealthStatus ' 'for argument `status` but got {}'.format(status)) with self._server_status_lock: self._server_status[service] = status diff --git a/src/ruby/.rubocop.yml b/src/ruby/.rubocop.yml index dd57ab60828..ff5cf8db831 100644 --- a/src/ruby/.rubocop.yml +++ b/src/ruby/.rubocop.yml @@ -7,7 +7,7 @@ AllCops: - 'bin/apis/**/*' - 'bin/math.rb' - 'bin/math_services.rb' - - 'pb/grpc/health/v1alpha/*' + - 'pb/grpc/health/v1/*' - 'pb/test/**/*' Metrics/CyclomaticComplexity: diff --git a/src/ruby/pb/README.md b/src/ruby/pb/README.md index e04aef185ca..d9e30bbc854 100644 --- a/src/ruby/pb/README.md +++ b/src/ruby/pb/README.md @@ -11,7 +11,7 @@ The code is is generated using the protoc (> 3.0.0.alpha.1) and the grpc_ruby_plugin. These must be installed to regenerate the IDL defined classes, but that's not necessary just to use them. -health_check/v1alpha +health_check/v1 -------------------- This package defines the surface of a simple health check service that gRPC @@ -20,7 +20,7 @@ re-generate the surface. ```bash $ # (from this directory) -$ protoc -I ../../proto ../../proto/grpc/health/v1alpha/health.proto \ +$ protoc -I ../../proto ../../proto/grpc/health/v1/health.proto \ --grpc_out=. \ --ruby_out=. \ --plugin=protoc-gen-grpc=`which grpc_ruby_plugin` diff --git a/src/ruby/pb/generate_proto_ruby.sh b/src/ruby/pb/generate_proto_ruby.sh index 576b1c08d30..86c082099d9 100755 --- a/src/ruby/pb/generate_proto_ruby.sh +++ b/src/ruby/pb/generate_proto_ruby.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright 2015, Google Inc. +# Copyright 2015-2016, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -35,7 +35,7 @@ cd $(dirname $0)/../../.. PROTOC=bins/opt/protobuf/protoc PLUGIN=protoc-gen-grpc=bins/opt/grpc_ruby_plugin -$PROTOC -I src/proto src/proto/grpc/health/v1alpha/health.proto \ +$PROTOC -I src/proto src/proto/grpc/health/v1/health.proto \ --grpc_out=src/ruby/pb \ --ruby_out=src/ruby/pb \ --plugin=$PLUGIN diff --git a/src/ruby/pb/grpc/health/checker.rb b/src/ruby/pb/grpc/health/checker.rb index 8c692e74f90..0af4c5b0a8d 100644 --- a/src/ruby/pb/grpc/health/checker.rb +++ b/src/ruby/pb/grpc/health/checker.rb @@ -1,4 +1,4 @@ -# Copyright 2015, Google Inc. +# Copyright 2015-2016, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -28,7 +28,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. require 'grpc' -require 'grpc/health/v1alpha/health_services' +require 'grpc/health/v1/health_services' require 'thread' module Grpc @@ -36,9 +36,9 @@ module Grpc # service. module Health # Checker is implementation of the schema-specified health checking service. - class Checker < V1alpha::Health::Service + class Checker < V1::Health::Service StatusCodes = GRPC::Core::StatusCodes - HealthCheckResponse = V1alpha::HealthCheckResponse + HealthCheckResponse = V1::HealthCheckResponse # Initializes the statuses of participating services def initialize diff --git a/src/ruby/pb/grpc/health/v1/health.rb b/src/ruby/pb/grpc/health/v1/health.rb new file mode 100644 index 00000000000..ca27afb8e1c --- /dev/null +++ b/src/ruby/pb/grpc/health/v1/health.rb @@ -0,0 +1,29 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: grpc/health/v1/health.proto + +require 'google/protobuf' + +Google::Protobuf::DescriptorPool.generated_pool.build do + add_message "grpc.health.v1.HealthCheckRequest" do + optional :host, :string, 1 + optional :service, :string, 2 + end + add_message "grpc.health.v1.HealthCheckResponse" do + optional :status, :enum, 1, "grpc.health.v1.HealthCheckResponse.ServingStatus" + end + add_enum "grpc.health.v1.HealthCheckResponse.ServingStatus" do + value :UNKNOWN, 0 + value :SERVING, 1 + value :NOT_SERVING, 2 + end +end + +module Grpc + module Health + module V1 + HealthCheckRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.health.v1.HealthCheckRequest").msgclass + HealthCheckResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.health.v1.HealthCheckResponse").msgclass + HealthCheckResponse::ServingStatus = Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.health.v1.HealthCheckResponse.ServingStatus").enummodule + end + end +end diff --git a/src/ruby/pb/grpc/health/v1alpha/health_services.rb b/src/ruby/pb/grpc/health/v1/health_services.rb similarity index 71% rename from src/ruby/pb/grpc/health/v1alpha/health_services.rb rename to src/ruby/pb/grpc/health/v1/health_services.rb index d5cba2e9ec7..cb79b20437f 100644 --- a/src/ruby/pb/grpc/health/v1alpha/health_services.rb +++ b/src/ruby/pb/grpc/health/v1/health_services.rb @@ -1,12 +1,12 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! -# Source: grpc/health/v1alpha/health.proto for package 'grpc.health.v1alpha' +# Source: grpc/health/v1/health.proto for package 'grpc.health.v1' require 'grpc' -require 'grpc/health/v1alpha/health' +require 'grpc/health/v1/health' module Grpc module Health - module V1alpha + module V1 module Health # TODO: add proto service documentation here @@ -16,7 +16,7 @@ module Grpc self.marshal_class_method = :encode self.unmarshal_class_method = :decode - self.service_name = 'grpc.health.v1alpha.Health' + self.service_name = 'grpc.health.v1.Health' rpc :Check, HealthCheckRequest, HealthCheckResponse end diff --git a/src/ruby/pb/grpc/health/v1alpha/health.rb b/src/ruby/pb/grpc/health/v1alpha/health.rb deleted file mode 100644 index 9c04298ea54..00000000000 --- a/src/ruby/pb/grpc/health/v1alpha/health.rb +++ /dev/null @@ -1,29 +0,0 @@ -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: grpc/health/v1alpha/health.proto - -require 'google/protobuf' - -Google::Protobuf::DescriptorPool.generated_pool.build do - add_message "grpc.health.v1alpha.HealthCheckRequest" do - optional :host, :string, 1 - optional :service, :string, 2 - end - add_message "grpc.health.v1alpha.HealthCheckResponse" do - optional :status, :enum, 1, "grpc.health.v1alpha.HealthCheckResponse.ServingStatus" - end - add_enum "grpc.health.v1alpha.HealthCheckResponse.ServingStatus" do - value :UNKNOWN, 0 - value :SERVING, 1 - value :NOT_SERVING, 2 - end -end - -module Grpc - module Health - module V1alpha - HealthCheckRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.health.v1alpha.HealthCheckRequest").msgclass - HealthCheckResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.health.v1alpha.HealthCheckResponse").msgclass - HealthCheckResponse::ServingStatus = Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.health.v1alpha.HealthCheckResponse.ServingStatus").enummodule - end - end -end diff --git a/src/ruby/spec/pb/health/checker_spec.rb b/src/ruby/spec/pb/health/checker_spec.rb index c1decd822a7..fe4e5269bb0 100644 --- a/src/ruby/spec/pb/health/checker_spec.rb +++ b/src/ruby/spec/pb/health/checker_spec.rb @@ -28,7 +28,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. require 'grpc' -require 'grpc/health/v1alpha/health' +require 'grpc/health/v1/health' require 'grpc/health/checker' require 'open3' require 'tmpdir' @@ -43,7 +43,7 @@ describe 'Health protobuf code generation' do skip 'protoc || grpc_ruby_plugin missing, cannot verify health code-gen' else it 'should already be loaded indirectly i.e, used by the other specs' do - expect(require('grpc/health/v1alpha/health_services')).to be(false) + expect(require('grpc/health/v1/health_services')).to be(false) end it 'should have the same content as created by code generation' do @@ -52,7 +52,7 @@ describe 'Health protobuf code generation' do # Get the current content service_path = File.join(root_dir, 'ruby', 'pb', 'grpc', - 'health', 'v1alpha', 'health_services.rb') + 'health', 'v1', 'health_services.rb') want = nil File.open(service_path) { |f| want = f.read } @@ -61,12 +61,12 @@ describe 'Health protobuf code generation' do plugin = plugin.strip got = nil Dir.mktmpdir do |tmp_dir| - gen_out = File.join(tmp_dir, 'grpc', 'health', 'v1alpha', + gen_out = File.join(tmp_dir, 'grpc', 'health', 'v1', 'health_services.rb') pid = spawn( 'protoc', '-I.', - 'grpc/health/v1alpha/health.proto', + 'grpc/health/v1/health.proto', "--grpc_out=#{tmp_dir}", "--plugin=protoc-gen-grpc=#{plugin}", chdir: pb_dir) @@ -81,9 +81,9 @@ end describe Grpc::Health::Checker do StatusCodes = GRPC::Core::StatusCodes - ServingStatus = Grpc::Health::V1alpha::HealthCheckResponse::ServingStatus - HCResp = Grpc::Health::V1alpha::HealthCheckResponse - HCReq = Grpc::Health::V1alpha::HealthCheckRequest + ServingStatus = Grpc::Health::V1::HealthCheckResponse::ServingStatus + HCResp = Grpc::Health::V1::HealthCheckResponse + HCReq = Grpc::Health::V1::HealthCheckRequest success_tests = [ {