global replace health check proto v1alpha to v1

pull/5327/head
yang-g 9 years ago
parent 49d297a29c
commit aea13f1c85
  1. 4
      doc/health-checking.md
  2. 2
      src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.nuspec
  3. 30
      src/csharp/Grpc.HealthCheck/HealthGrpc.cs
  4. 2
      src/csharp/generate_proto_csharp.sh
  5. 6
      src/node/health_check/health.js
  6. 7
      src/proto/grpc/health/v1/health.proto
  7. 2
      src/python/grpcio_health_checking/grpc/health/v1/__init__.py
  8. 4
      src/python/grpcio_health_checking/grpc/health/v1/health.proto
  9. 6
      src/python/grpcio_health_checking/grpc/health/v1/health.py
  10. 2
      src/ruby/.rubocop.yml
  11. 4
      src/ruby/pb/README.md
  12. 4
      src/ruby/pb/generate_proto_ruby.sh
  13. 8
      src/ruby/pb/grpc/health/checker.rb
  14. 29
      src/ruby/pb/grpc/health/v1/health.rb
  15. 8
      src/ruby/pb/grpc/health/v1/health_services.rb
  16. 29
      src/ruby/pb/grpc/health/v1alpha/health.rb
  17. 16
      src/ruby/spec/pb/health/checker_spec.rb

@ -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

@ -4,7 +4,7 @@
<id>Grpc.HealthCheck</id>
<title>gRPC C# Healthchecking</title>
<summary>Implementation of gRPC health service</summary>
<description>Example implementation of grpc.health.v1alpha service that can be used for health-checking.</description>
<description>Example implementation of grpc.health.v1 service that can be used for health-checking.</description>
<version>$version$</version>
<authors>Google Inc.</authors>
<owners>grpc-packages</owners>

@ -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<global::Grpc.Health.V1Alpha.HealthCheckRequest> __Marshaller_HealthCheckRequest = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Health.V1Alpha.HealthCheckRequest.Parser.ParseFrom);
static readonly Marshaller<global::Grpc.Health.V1Alpha.HealthCheckResponse> __Marshaller_HealthCheckResponse = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Health.V1Alpha.HealthCheckResponse.Parser.ParseFrom);
static readonly Marshaller<global::Grpc.Health.V1.HealthCheckRequest> __Marshaller_HealthCheckRequest = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Health.V1.HealthCheckRequest.Parser.ParseFrom);
static readonly Marshaller<global::Grpc.Health.V1.HealthCheckResponse> __Marshaller_HealthCheckResponse = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Health.V1.HealthCheckResponse.Parser.ParseFrom);
static readonly Method<global::Grpc.Health.V1Alpha.HealthCheckRequest, global::Grpc.Health.V1Alpha.HealthCheckResponse> __Method_Check = new Method<global::Grpc.Health.V1Alpha.HealthCheckRequest, global::Grpc.Health.V1Alpha.HealthCheckResponse>(
static readonly Method<global::Grpc.Health.V1.HealthCheckRequest, global::Grpc.Health.V1.HealthCheckResponse> __Method_Check = new Method<global::Grpc.Health.V1.HealthCheckRequest, global::Grpc.Health.V1.HealthCheckResponse>(
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<global::Grpc.Health.V1Alpha.HealthCheckResponse> CheckAsync(global::Grpc.Health.V1Alpha.HealthCheckRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));
AsyncUnaryCall<global::Grpc.Health.V1Alpha.HealthCheckResponse> 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<global::Grpc.Health.V1.HealthCheckResponse> CheckAsync(global::Grpc.Health.V1.HealthCheckRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));
AsyncUnaryCall<global::Grpc.Health.V1.HealthCheckResponse> CheckAsync(global::Grpc.Health.V1.HealthCheckRequest request, CallOptions options);
}
// server-side interface
public interface IHealth
{
Task<global::Grpc.Health.V1Alpha.HealthCheckResponse> Check(global::Grpc.Health.V1Alpha.HealthCheckRequest request, ServerCallContext context);
Task<global::Grpc.Health.V1.HealthCheckResponse> 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<global::Grpc.Health.V1Alpha.HealthCheckResponse> CheckAsync(global::Grpc.Health.V1Alpha.HealthCheckRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
public AsyncUnaryCall<global::Grpc.Health.V1.HealthCheckResponse> 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<global::Grpc.Health.V1Alpha.HealthCheckResponse> CheckAsync(global::Grpc.Health.V1Alpha.HealthCheckRequest request, CallOptions options)
public AsyncUnaryCall<global::Grpc.Health.V1.HealthCheckResponse> CheckAsync(global::Grpc.Health.V1.HealthCheckRequest request, CallOptions options)
{
var call = CreateCall(__Method_Check, options);
return Calls.AsyncUnaryCall(call, request);

@ -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

@ -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);

@ -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 {

@ -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

@ -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;

@ -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

@ -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:

@ -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`

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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 =
[
{

Loading…
Cancel
Save