diff --git a/src/Grpc.HealthCheck/Grpc.HealthCheck.csproj b/src/Grpc.HealthCheck/Grpc.HealthCheck.csproj
index f7b92dc1a..f14250984 100755
--- a/src/Grpc.HealthCheck/Grpc.HealthCheck.csproj
+++ b/src/Grpc.HealthCheck/Grpc.HealthCheck.csproj
@@ -5,7 +5,7 @@
true
true
- net462;netstandard2.0
+ net462;netstandard2.0;net6.0;net7.0;net8.0
README.md
@@ -19,9 +19,13 @@
-
+
+
+
+
-
+
+
diff --git a/src/Grpc.HealthCheck/Health.cs b/src/Grpc.HealthCheck/Health.cs
deleted file mode 100644
index 2bc976f1b..000000000
--- a/src/Grpc.HealthCheck/Health.cs
+++ /dev/null
@@ -1,450 +0,0 @@
-//
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: grpc/health/v1/health.proto
-//
-#pragma warning disable 1591, 0612, 3021
-#region Designer generated code
-
-using pb = global::Google.Protobuf;
-using pbc = global::Google.Protobuf.Collections;
-using pbr = global::Google.Protobuf.Reflection;
-using scg = global::System.Collections.Generic;
-namespace Grpc.Health.V1 {
-
- /// Holder for reflection information generated from grpc/health/v1/health.proto
- public static partial class HealthReflection {
-
- #region Descriptor
- /// File descriptor for grpc/health/v1/health.proto
- public static pbr::FileDescriptor Descriptor {
- get { return descriptor; }
- }
- private static pbr::FileDescriptor descriptor;
-
- static HealthReflection() {
- byte[] descriptorData = global::System.Convert.FromBase64String(
- string.Concat(
- "ChtncnBjL2hlYWx0aC92MS9oZWFsdGgucHJvdG8SDmdycGMuaGVhbHRoLnYx",
- "IiUKEkhlYWx0aENoZWNrUmVxdWVzdBIPCgdzZXJ2aWNlGAEgASgJIqkBChNI",
- "ZWFsdGhDaGVja1Jlc3BvbnNlEkEKBnN0YXR1cxgBIAEoDjIxLmdycGMuaGVh",
- "bHRoLnYxLkhlYWx0aENoZWNrUmVzcG9uc2UuU2VydmluZ1N0YXR1cyJPCg1T",
- "ZXJ2aW5nU3RhdHVzEgsKB1VOS05PV04QABILCgdTRVJWSU5HEAESDwoLTk9U",
- "X1NFUlZJTkcQAhITCg9TRVJWSUNFX1VOS05PV04QAzKuAQoGSGVhbHRoElAK",
- "BUNoZWNrEiIuZ3JwYy5oZWFsdGgudjEuSGVhbHRoQ2hlY2tSZXF1ZXN0GiMu",
- "Z3JwYy5oZWFsdGgudjEuSGVhbHRoQ2hlY2tSZXNwb25zZRJSCgVXYXRjaBIi",
- "LmdycGMuaGVhbHRoLnYxLkhlYWx0aENoZWNrUmVxdWVzdBojLmdycGMuaGVh",
- "bHRoLnYxLkhlYWx0aENoZWNrUmVzcG9uc2UwAUJhChFpby5ncnBjLmhlYWx0",
- "aC52MUILSGVhbHRoUHJvdG9QAVosZ29vZ2xlLmdvbGFuZy5vcmcvZ3JwYy9o",
- "ZWFsdGgvZ3JwY19oZWFsdGhfdjGqAg5HcnBjLkhlYWx0aC5WMWIGcHJvdG8z"));
- descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
- new pbr::FileDescriptor[] { },
- new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
- new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Health.V1.HealthCheckRequest), global::Grpc.Health.V1.HealthCheckRequest.Parser, new[]{ "Service" }, null, null, null, null),
- new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Health.V1.HealthCheckResponse), global::Grpc.Health.V1.HealthCheckResponse.Parser, new[]{ "Status" }, null, new[]{ typeof(global::Grpc.Health.V1.HealthCheckResponse.Types.ServingStatus) }, null, null)
- }));
- }
- #endregion
-
- }
- #region Messages
- public sealed partial class HealthCheckRequest : pb::IMessage
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- , pb::IBufferMessage
- #endif
- {
- private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HealthCheckRequest());
- private pb::UnknownFieldSet _unknownFields;
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public static pb::MessageParser Parser { get { return _parser; } }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Health.V1.HealthReflection.Descriptor.MessageTypes[0]; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- pbr::MessageDescriptor pb::IMessage.Descriptor {
- get { return Descriptor; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public HealthCheckRequest() {
- OnConstruction();
- }
-
- partial void OnConstruction();
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public HealthCheckRequest(HealthCheckRequest other) : this() {
- service_ = other.service_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public HealthCheckRequest Clone() {
- return new HealthCheckRequest(this);
- }
-
- /// Field number for the "service" field.
- public const int ServiceFieldNumber = 1;
- private string service_ = "";
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public string Service {
- get { return service_; }
- set {
- service_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
- }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public override bool Equals(object other) {
- return Equals(other as HealthCheckRequest);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public bool Equals(HealthCheckRequest other) {
- if (ReferenceEquals(other, null)) {
- return false;
- }
- if (ReferenceEquals(other, this)) {
- return true;
- }
- if (Service != other.Service) return false;
- return Equals(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public override int GetHashCode() {
- int hash = 1;
- if (Service.Length != 0) hash ^= Service.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
- return hash;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public override string ToString() {
- return pb::JsonFormatter.ToDiagnosticString(this);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public void WriteTo(pb::CodedOutputStream output) {
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- output.WriteRawMessage(this);
- #else
- if (Service.Length != 0) {
- output.WriteRawTag(10);
- output.WriteString(Service);
- }
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
- #endif
- }
-
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
- if (Service.Length != 0) {
- output.WriteRawTag(10);
- output.WriteString(Service);
- }
- if (_unknownFields != null) {
- _unknownFields.WriteTo(ref output);
- }
- }
- #endif
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public int CalculateSize() {
- int size = 0;
- if (Service.Length != 0) {
- size += 1 + pb::CodedOutputStream.ComputeStringSize(Service);
- }
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
- return size;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public void MergeFrom(HealthCheckRequest other) {
- if (other == null) {
- return;
- }
- if (other.Service.Length != 0) {
- Service = other.Service;
- }
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public void MergeFrom(pb::CodedInputStream input) {
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- input.ReadRawMessage(this);
- #else
- uint tag;
- while ((tag = input.ReadTag()) != 0) {
- switch(tag) {
- default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
- break;
- case 10: {
- Service = input.ReadString();
- break;
- }
- }
- }
- #endif
- }
-
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
- uint tag;
- while ((tag = input.ReadTag()) != 0) {
- switch(tag) {
- default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
- break;
- case 10: {
- Service = input.ReadString();
- break;
- }
- }
- }
- }
- #endif
-
- }
-
- public sealed partial class HealthCheckResponse : pb::IMessage
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- , pb::IBufferMessage
- #endif
- {
- private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HealthCheckResponse());
- private pb::UnknownFieldSet _unknownFields;
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public static pb::MessageParser Parser { get { return _parser; } }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Health.V1.HealthReflection.Descriptor.MessageTypes[1]; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- pbr::MessageDescriptor pb::IMessage.Descriptor {
- get { return Descriptor; }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public HealthCheckResponse() {
- OnConstruction();
- }
-
- partial void OnConstruction();
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public HealthCheckResponse(HealthCheckResponse other) : this() {
- status_ = other.status_;
- _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public HealthCheckResponse Clone() {
- return new HealthCheckResponse(this);
- }
-
- /// Field number for the "status" field.
- public const int StatusFieldNumber = 1;
- private global::Grpc.Health.V1.HealthCheckResponse.Types.ServingStatus status_ = global::Grpc.Health.V1.HealthCheckResponse.Types.ServingStatus.Unknown;
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public global::Grpc.Health.V1.HealthCheckResponse.Types.ServingStatus Status {
- get { return status_; }
- set {
- status_ = value;
- }
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public override bool Equals(object other) {
- return Equals(other as HealthCheckResponse);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public bool Equals(HealthCheckResponse other) {
- if (ReferenceEquals(other, null)) {
- return false;
- }
- if (ReferenceEquals(other, this)) {
- return true;
- }
- if (Status != other.Status) return false;
- return Equals(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public override int GetHashCode() {
- int hash = 1;
- if (Status != global::Grpc.Health.V1.HealthCheckResponse.Types.ServingStatus.Unknown) hash ^= Status.GetHashCode();
- if (_unknownFields != null) {
- hash ^= _unknownFields.GetHashCode();
- }
- return hash;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public override string ToString() {
- return pb::JsonFormatter.ToDiagnosticString(this);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public void WriteTo(pb::CodedOutputStream output) {
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- output.WriteRawMessage(this);
- #else
- if (Status != global::Grpc.Health.V1.HealthCheckResponse.Types.ServingStatus.Unknown) {
- output.WriteRawTag(8);
- output.WriteEnum((int) Status);
- }
- if (_unknownFields != null) {
- _unknownFields.WriteTo(output);
- }
- #endif
- }
-
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
- if (Status != global::Grpc.Health.V1.HealthCheckResponse.Types.ServingStatus.Unknown) {
- output.WriteRawTag(8);
- output.WriteEnum((int) Status);
- }
- if (_unknownFields != null) {
- _unknownFields.WriteTo(ref output);
- }
- }
- #endif
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public int CalculateSize() {
- int size = 0;
- if (Status != global::Grpc.Health.V1.HealthCheckResponse.Types.ServingStatus.Unknown) {
- size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Status);
- }
- if (_unknownFields != null) {
- size += _unknownFields.CalculateSize();
- }
- return size;
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public void MergeFrom(HealthCheckResponse other) {
- if (other == null) {
- return;
- }
- if (other.Status != global::Grpc.Health.V1.HealthCheckResponse.Types.ServingStatus.Unknown) {
- Status = other.Status;
- }
- _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
- }
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public void MergeFrom(pb::CodedInputStream input) {
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- input.ReadRawMessage(this);
- #else
- uint tag;
- while ((tag = input.ReadTag()) != 0) {
- switch(tag) {
- default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
- break;
- case 8: {
- Status = (global::Grpc.Health.V1.HealthCheckResponse.Types.ServingStatus) input.ReadEnum();
- break;
- }
- }
- }
- #endif
- }
-
- #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
- uint tag;
- while ((tag = input.ReadTag()) != 0) {
- switch(tag) {
- default:
- _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
- break;
- case 8: {
- Status = (global::Grpc.Health.V1.HealthCheckResponse.Types.ServingStatus) input.ReadEnum();
- break;
- }
- }
- }
- }
- #endif
-
- #region Nested types
- /// Container for nested types declared in the HealthCheckResponse message type.
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
- public static partial class Types {
- public enum ServingStatus {
- [pbr::OriginalName("UNKNOWN")] Unknown = 0,
- [pbr::OriginalName("SERVING")] Serving = 1,
- [pbr::OriginalName("NOT_SERVING")] NotServing = 2,
- ///
- /// Used only by the Watch method.
- ///
- [pbr::OriginalName("SERVICE_UNKNOWN")] ServiceUnknown = 3,
- }
-
- }
- #endregion
-
- }
-
- #endregion
-
-}
-
-#endregion Designer generated code
diff --git a/src/Grpc.HealthCheck/HealthGrpc.cs b/src/Grpc.HealthCheck/HealthGrpc.cs
deleted file mode 100644
index 1984f6e66..000000000
--- a/src/Grpc.HealthCheck/HealthGrpc.cs
+++ /dev/null
@@ -1,301 +0,0 @@
-//
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: grpc/health/v1/health.proto
-//
-// Original file comments:
-// Copyright 2015 The gRPC Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-// The canonical version of this proto can be found at
-// https://github.com/grpc/grpc-proto/blob/master/grpc/health/v1/health.proto
-//
-#pragma warning disable 0414, 1591
-#region Designer generated code
-
-using grpc = global::Grpc.Core;
-
-namespace Grpc.Health.V1 {
- public static partial class Health
- {
- static readonly string __ServiceName = "grpc.health.v1.Health";
-
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context)
- {
- #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
- if (message is global::Google.Protobuf.IBufferMessage)
- {
- context.SetPayloadLength(message.CalculateSize());
- global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter());
- context.Complete();
- return;
- }
- #endif
- context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message));
- }
-
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- static class __Helper_MessageCache
- {
- public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T));
- }
-
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- static T __Helper_DeserializeMessage(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser parser) where T : global::Google.Protobuf.IMessage
- {
- #if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
- if (__Helper_MessageCache.IsBufferMessage)
- {
- return parser.ParseFrom(context.PayloadAsReadOnlySequence());
- }
- #endif
- return parser.ParseFrom(context.PayloadAsNewBuffer());
- }
-
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- static readonly grpc::Marshaller __Marshaller_grpc_health_v1_HealthCheckRequest = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Health.V1.HealthCheckRequest.Parser));
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- static readonly grpc::Marshaller __Marshaller_grpc_health_v1_HealthCheckResponse = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Grpc.Health.V1.HealthCheckResponse.Parser));
-
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- static readonly grpc::Method __Method_Check = new grpc::Method(
- grpc::MethodType.Unary,
- __ServiceName,
- "Check",
- __Marshaller_grpc_health_v1_HealthCheckRequest,
- __Marshaller_grpc_health_v1_HealthCheckResponse);
-
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- static readonly grpc::Method __Method_Watch = new grpc::Method(
- grpc::MethodType.ServerStreaming,
- __ServiceName,
- "Watch",
- __Marshaller_grpc_health_v1_HealthCheckRequest,
- __Marshaller_grpc_health_v1_HealthCheckResponse);
-
- /// Service descriptor
- public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
- {
- get { return global::Grpc.Health.V1.HealthReflection.Descriptor.Services[0]; }
- }
-
- /// Base class for server-side implementations of Health
- [grpc::BindServiceMethod(typeof(Health), "BindService")]
- public abstract partial class HealthBase
- {
- ///
- /// If the requested service is unknown, the call will fail with status
- /// NOT_FOUND.
- ///
- /// The request received from the client.
- /// The context of the server-side call handler being invoked.
- /// The response to send back to the client (wrapped by a task).
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- public virtual global::System.Threading.Tasks.Task Check(global::Grpc.Health.V1.HealthCheckRequest request, grpc::ServerCallContext context)
- {
- throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
- }
-
- ///
- /// Performs a watch for the serving status of the requested service.
- /// The server will immediately send back a message indicating the current
- /// serving status. It will then subsequently send a new message whenever
- /// the service's serving status changes.
- ///
- /// If the requested service is unknown when the call is received, the
- /// server will send a message setting the serving status to
- /// SERVICE_UNKNOWN but will *not* terminate the call. If at some
- /// future point, the serving status of the service becomes known, the
- /// server will send a new message with the service's serving status.
- ///
- /// If the call terminates with status UNIMPLEMENTED, then clients
- /// should assume this method is not supported and should not retry the
- /// call. If the call terminates with any other status (including OK),
- /// clients should retry the call with appropriate exponential backoff.
- ///
- /// The request received from the client.
- /// Used for sending responses back to the client.
- /// The context of the server-side call handler being invoked.
- /// A task indicating completion of the handler.
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- public virtual global::System.Threading.Tasks.Task Watch(global::Grpc.Health.V1.HealthCheckRequest request, grpc::IServerStreamWriter responseStream, grpc::ServerCallContext context)
- {
- throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
- }
-
- }
-
- /// Client for Health
- public partial class HealthClient : grpc::ClientBase
- {
- /// Creates a new client for Health
- /// The channel to use to make remote calls.
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- public HealthClient(grpc::ChannelBase channel) : base(channel)
- {
- }
- /// Creates a new client for Health that uses a custom CallInvoker.
- /// The callInvoker to use to make remote calls.
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- public HealthClient(grpc::CallInvoker callInvoker) : base(callInvoker)
- {
- }
- /// Protected parameterless constructor to allow creation of test doubles.
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- protected HealthClient() : base()
- {
- }
- /// Protected constructor to allow creation of configured clients.
- /// The client configuration.
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- protected HealthClient(ClientBaseConfiguration configuration) : base(configuration)
- {
- }
-
- ///
- /// If the requested service is unknown, the call will fail with status
- /// NOT_FOUND.
- ///
- /// The request to send to the server.
- /// The initial metadata to send with the call. This parameter is optional.
- /// An optional deadline for the call. The call will be cancelled if deadline is hit.
- /// An optional token for canceling the call.
- /// The response received from the server.
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- public virtual global::Grpc.Health.V1.HealthCheckResponse Check(global::Grpc.Health.V1.HealthCheckRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
- {
- return Check(request, new grpc::CallOptions(headers, deadline, cancellationToken));
- }
- ///
- /// If the requested service is unknown, the call will fail with status
- /// NOT_FOUND.
- ///
- /// The request to send to the server.
- /// The options for the call.
- /// The response received from the server.
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- public virtual global::Grpc.Health.V1.HealthCheckResponse Check(global::Grpc.Health.V1.HealthCheckRequest request, grpc::CallOptions options)
- {
- return CallInvoker.BlockingUnaryCall(__Method_Check, null, options, request);
- }
- ///
- /// If the requested service is unknown, the call will fail with status
- /// NOT_FOUND.
- ///
- /// The request to send to the server.
- /// The initial metadata to send with the call. This parameter is optional.
- /// An optional deadline for the call. The call will be cancelled if deadline is hit.
- /// An optional token for canceling the call.
- /// The call object.
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- public virtual grpc::AsyncUnaryCall CheckAsync(global::Grpc.Health.V1.HealthCheckRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
- {
- return CheckAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
- }
- ///
- /// If the requested service is unknown, the call will fail with status
- /// NOT_FOUND.
- ///
- /// The request to send to the server.
- /// The options for the call.
- /// The call object.
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- public virtual grpc::AsyncUnaryCall CheckAsync(global::Grpc.Health.V1.HealthCheckRequest request, grpc::CallOptions options)
- {
- return CallInvoker.AsyncUnaryCall(__Method_Check, null, options, request);
- }
- ///
- /// Performs a watch for the serving status of the requested service.
- /// The server will immediately send back a message indicating the current
- /// serving status. It will then subsequently send a new message whenever
- /// the service's serving status changes.
- ///
- /// If the requested service is unknown when the call is received, the
- /// server will send a message setting the serving status to
- /// SERVICE_UNKNOWN but will *not* terminate the call. If at some
- /// future point, the serving status of the service becomes known, the
- /// server will send a new message with the service's serving status.
- ///
- /// If the call terminates with status UNIMPLEMENTED, then clients
- /// should assume this method is not supported and should not retry the
- /// call. If the call terminates with any other status (including OK),
- /// clients should retry the call with appropriate exponential backoff.
- ///
- /// The request to send to the server.
- /// The initial metadata to send with the call. This parameter is optional.
- /// An optional deadline for the call. The call will be cancelled if deadline is hit.
- /// An optional token for canceling the call.
- /// The call object.
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- public virtual grpc::AsyncServerStreamingCall Watch(global::Grpc.Health.V1.HealthCheckRequest request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
- {
- return Watch(request, new grpc::CallOptions(headers, deadline, cancellationToken));
- }
- ///
- /// Performs a watch for the serving status of the requested service.
- /// The server will immediately send back a message indicating the current
- /// serving status. It will then subsequently send a new message whenever
- /// the service's serving status changes.
- ///
- /// If the requested service is unknown when the call is received, the
- /// server will send a message setting the serving status to
- /// SERVICE_UNKNOWN but will *not* terminate the call. If at some
- /// future point, the serving status of the service becomes known, the
- /// server will send a new message with the service's serving status.
- ///
- /// If the call terminates with status UNIMPLEMENTED, then clients
- /// should assume this method is not supported and should not retry the
- /// call. If the call terminates with any other status (including OK),
- /// clients should retry the call with appropriate exponential backoff.
- ///
- /// The request to send to the server.
- /// The options for the call.
- /// The call object.
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- public virtual grpc::AsyncServerStreamingCall Watch(global::Grpc.Health.V1.HealthCheckRequest request, grpc::CallOptions options)
- {
- return CallInvoker.AsyncServerStreamingCall(__Method_Watch, null, options, request);
- }
- /// Creates a new instance of client from given ClientBaseConfiguration.
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- protected override HealthClient NewInstance(ClientBaseConfiguration configuration)
- {
- return new HealthClient(configuration);
- }
- }
-
- /// Creates service definition that can be registered with a server
- /// An object implementing the server-side handling logic.
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- public static grpc::ServerServiceDefinition BindService(HealthBase serviceImpl)
- {
- return grpc::ServerServiceDefinition.CreateBuilder()
- .AddMethod(__Method_Check, serviceImpl.Check)
- .AddMethod(__Method_Watch, serviceImpl.Watch).Build();
- }
-
- /// Register service method with a service binder with or without implementation. Useful when customizing the service binding logic.
- /// Note: this method is part of an experimental API that can change or be removed without any prior notice.
- /// Service methods will be bound by calling AddMethod on this object.
- /// An object implementing the server-side handling logic.
- [global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
- public static void BindService(grpc::ServiceBinderBase serviceBinder, HealthBase serviceImpl)
- {
- serviceBinder.AddMethod(__Method_Check, serviceImpl == null ? null : new grpc::UnaryServerMethod(serviceImpl.Check));
- serviceBinder.AddMethod(__Method_Watch, serviceImpl == null ? null : new grpc::ServerStreamingServerMethod(serviceImpl.Watch));
- }
-
- }
-}
-#endregion
diff --git a/src/Grpc.HealthCheck/HealthServiceImpl.cs b/src/Grpc.HealthCheck/HealthServiceImpl.cs
index c465cdaf7..80003ee68 100644
--- a/src/Grpc.HealthCheck/HealthServiceImpl.cs
+++ b/src/Grpc.HealthCheck/HealthServiceImpl.cs
@@ -157,7 +157,7 @@ public override async Task Watch(HealthCheckRequest request, IServerStreamWriter
lock (watchersLock)
{
- if (!watchers.TryGetValue(service, out List> channelWriters))
+ if (!watchers.TryGetValue(service, out List>? channelWriters))
{
channelWriters = new List>();
watchers.Add(service, channelWriters);
@@ -170,7 +170,7 @@ public override async Task Watch(HealthCheckRequest request, IServerStreamWriter
context.CancellationToken.Register(() => {
lock (watchersLock)
{
- if (watchers.TryGetValue(service, out List> channelWriters))
+ if (watchers.TryGetValue(service, out List>? channelWriters))
{
// Remove the writer from the watchers
if (channelWriters.Remove(channel.Writer))
@@ -196,7 +196,7 @@ public override async Task Watch(HealthCheckRequest request, IServerStreamWriter
// Loop will exit when the call is canceled and the writer is marked as complete.
while (await channel.Reader.WaitToReadAsync().ConfigureAwait(false))
{
- if (channel.Reader.TryRead(out HealthCheckResponse item))
+ if (channel.Reader.TryRead(out HealthCheckResponse? item))
{
await responseStream.WriteAsync(item).ConfigureAwait(false);
}
@@ -207,7 +207,7 @@ private void NotifyStatus(string service, HealthCheckResponse.Types.ServingStatu
{
lock (watchersLock)
{
- if (watchers.TryGetValue(service, out List> channelWriters))
+ if (watchers.TryGetValue(service, out List>? channelWriters))
{
HealthCheckResponse response = new HealthCheckResponse { Status = status };
diff --git a/src/Grpc.HealthCheck/health.proto b/src/Grpc.HealthCheck/health.proto
new file mode 100644
index 000000000..13b03f567
--- /dev/null
+++ b/src/Grpc.HealthCheck/health.proto
@@ -0,0 +1,73 @@
+// Copyright 2015 The gRPC Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// The canonical version of this proto can be found at
+// https://github.com/grpc/grpc-proto/blob/master/grpc/health/v1/health.proto
+
+syntax = "proto3";
+
+package grpc.health.v1;
+
+option csharp_namespace = "Grpc.Health.V1";
+option go_package = "google.golang.org/grpc/health/grpc_health_v1";
+option java_multiple_files = true;
+option java_outer_classname = "HealthProto";
+option java_package = "io.grpc.health.v1";
+
+message HealthCheckRequest {
+ string service = 1;
+}
+
+message HealthCheckResponse {
+ enum ServingStatus {
+ UNKNOWN = 0;
+ SERVING = 1;
+ NOT_SERVING = 2;
+ SERVICE_UNKNOWN = 3; // Used only by the Watch method.
+ }
+ ServingStatus status = 1;
+}
+
+// Health is gRPC's mechanism for checking whether a server is able to handle
+// RPCs. Its semantics are documented in
+// https://github.com/grpc/grpc/blob/master/doc/health-checking.md.
+service Health {
+ // Check gets the health of the specified service. If the requested service
+ // is unknown, the call will fail with status NOT_FOUND. If the caller does
+ // not specify a service name, the server should respond with its overall
+ // health status.
+ //
+ // Clients should set a deadline when calling Check, and can declare the
+ // server unhealthy if they do not receive a timely response.
+ //
+ // Check implementations should be idempotent and side effect free.
+ rpc Check(HealthCheckRequest) returns (HealthCheckResponse);
+
+ // Performs a watch for the serving status of the requested service.
+ // The server will immediately send back a message indicating the current
+ // serving status. It will then subsequently send a new message whenever
+ // the service's serving status changes.
+ //
+ // If the requested service is unknown when the call is received, the
+ // server will send a message setting the serving status to
+ // SERVICE_UNKNOWN but will *not* terminate the call. If at some
+ // future point, the serving status of the service becomes known, the
+ // server will send a new message with the service's serving status.
+ //
+ // If the call terminates with status UNIMPLEMENTED, then clients
+ // should assume this method is not supported and should not retry the
+ // call. If the call terminates with any other status (including OK),
+ // clients should retry the call with appropriate exponential backoff.
+ rpc Watch(HealthCheckRequest) returns (stream HealthCheckResponse);
+}