Skip to content
Snippets Groups Projects
Commit c18a8594 authored by Jan Tattermusch's avatar Jan Tattermusch
Browse files

Merge pull request #6348 from jtattermusch/csharp_codegen_comments

Add comments to generated C# files.
parents f128cd2c bfee01dd
No related branches found
No related tags found
No related merge requests found
...@@ -52,6 +52,7 @@ using grpc::protobuf::MethodDescriptor; ...@@ -52,6 +52,7 @@ using grpc::protobuf::MethodDescriptor;
using grpc::protobuf::io::Printer; using grpc::protobuf::io::Printer;
using grpc::protobuf::io::StringOutputStream; using grpc::protobuf::io::StringOutputStream;
using grpc_generator::MethodType; using grpc_generator::MethodType;
using grpc_generator::GetCppComments;
using grpc_generator::GetMethodType; using grpc_generator::GetMethodType;
using grpc_generator::METHODTYPE_NO_STREAMING; using grpc_generator::METHODTYPE_NO_STREAMING;
using grpc_generator::METHODTYPE_CLIENT_STREAMING; using grpc_generator::METHODTYPE_CLIENT_STREAMING;
...@@ -65,6 +66,56 @@ using std::vector; ...@@ -65,6 +66,56 @@ using std::vector;
namespace grpc_csharp_generator { namespace grpc_csharp_generator {
namespace { namespace {
// This function is a massaged version of
// https://github.com/google/protobuf/blob/master/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc
// Currently, we cannot easily reuse the functionality as
// google/protobuf/compiler/csharp/csharp_doc_comment.h is not a public header.
// TODO(jtattermusch): reuse the functionality from google/protobuf.
void GenerateDocCommentBodyImpl(grpc::protobuf::io::Printer* printer, grpc::protobuf::SourceLocation location) {
grpc::string comments = location.leading_comments.empty() ?
location.trailing_comments : location.leading_comments;
if (comments.empty()) {
return;
}
// XML escaping... no need for apostrophes etc as the whole text is going to be a child
// node of a summary element, not part of an attribute.
comments = grpc_generator::StringReplace(comments, "&", "&", true);
comments = grpc_generator::StringReplace(comments, "<", "&lt;", true);
std::vector<grpc::string> lines;
grpc_generator::Split(comments, '\n', &lines);
// TODO: We really should work out which part to put in the summary and which to put in the remarks...
// but that needs to be part of a bigger effort to understand the markdown better anyway.
printer->Print("/// <summary>\n");
bool last_was_empty = false;
// We squash multiple blank lines down to one, and remove any trailing blank lines. We need
// to preserve the blank lines themselves, as this is relevant in the markdown.
// Note that we can't remove leading or trailing whitespace as *that's* relevant in markdown too.
// (We don't skip "just whitespace" lines, either.)
for (std::vector<grpc::string>::iterator it = lines.begin(); it != lines.end(); ++it) {
grpc::string line = *it;
if (line.empty()) {
last_was_empty = true;
} else {
if (last_was_empty) {
printer->Print("///\n");
}
last_was_empty = false;
printer->Print("/// $line$\n", "line", *it);
}
}
printer->Print("/// </summary>\n");
}
template <typename DescriptorType>
void GenerateDocCommentBody(
grpc::protobuf::io::Printer* printer, const DescriptorType* descriptor) {
grpc::protobuf::SourceLocation location;
if (descriptor->GetSourceLocation(&location)) {
GenerateDocCommentBodyImpl(printer, location);
}
}
std::string GetServiceClassName(const ServiceDescriptor* service) { std::string GetServiceClassName(const ServiceDescriptor* service) {
return service->name(); return service->name();
} }
...@@ -242,7 +293,7 @@ void GenerateStaticMethodField(Printer* out, const MethodDescriptor *method) { ...@@ -242,7 +293,7 @@ void GenerateStaticMethodField(Printer* out, const MethodDescriptor *method) {
void GenerateServiceDescriptorProperty(Printer* out, const ServiceDescriptor *service) { void GenerateServiceDescriptorProperty(Printer* out, const ServiceDescriptor *service) {
std::ostringstream index; std::ostringstream index;
index << service->index(); index << service->index();
out->Print("// service descriptor\n"); out->Print("/// <summary>Service descriptor</summary>\n");
out->Print("public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor\n"); out->Print("public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor\n");
out->Print("{\n"); out->Print("{\n");
out->Print(" get { return $umbrella$.Descriptor.Services[$index$]; }\n", out->Print(" get { return $umbrella$.Descriptor.Services[$index$]; }\n",
...@@ -253,7 +304,8 @@ void GenerateServiceDescriptorProperty(Printer* out, const ServiceDescriptor *se ...@@ -253,7 +304,8 @@ void GenerateServiceDescriptorProperty(Printer* out, const ServiceDescriptor *se
} }
void GenerateClientInterface(Printer* out, const ServiceDescriptor *service) { void GenerateClientInterface(Printer* out, const ServiceDescriptor *service) {
out->Print("// client interface\n"); out->Print("/// <summary>Client for $servicename$</summary>\n",
"servicename", GetServiceClassName(service));
out->Print("[System.Obsolete(\"Client side interfaced will be removed " out->Print("[System.Obsolete(\"Client side interfaced will be removed "
"in the next release. Use client class directly.\")]\n"); "in the next release. Use client class directly.\")]\n");
out->Print("public interface $name$\n", "name", out->Print("public interface $name$\n", "name",
...@@ -266,6 +318,7 @@ void GenerateClientInterface(Printer* out, const ServiceDescriptor *service) { ...@@ -266,6 +318,7 @@ void GenerateClientInterface(Printer* out, const ServiceDescriptor *service) {
if (method_type == METHODTYPE_NO_STREAMING) { if (method_type == METHODTYPE_NO_STREAMING) {
// unary calls have an extra synchronous stub method // unary calls have an extra synchronous stub method
GenerateDocCommentBody(out, method);
out->Print( out->Print(
"$response$ $methodname$($request$ request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));\n", "$response$ $methodname$($request$ request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));\n",
"methodname", method->name(), "request", "methodname", method->name(), "request",
...@@ -273,6 +326,7 @@ void GenerateClientInterface(Printer* out, const ServiceDescriptor *service) { ...@@ -273,6 +326,7 @@ void GenerateClientInterface(Printer* out, const ServiceDescriptor *service) {
GetClassName(method->output_type())); GetClassName(method->output_type()));
// overload taking CallOptions as a param // overload taking CallOptions as a param
GenerateDocCommentBody(out, method);
out->Print( out->Print(
"$response$ $methodname$($request$ request, CallOptions options);\n", "$response$ $methodname$($request$ request, CallOptions options);\n",
"methodname", method->name(), "request", "methodname", method->name(), "request",
...@@ -284,6 +338,7 @@ void GenerateClientInterface(Printer* out, const ServiceDescriptor *service) { ...@@ -284,6 +338,7 @@ void GenerateClientInterface(Printer* out, const ServiceDescriptor *service) {
if (method_type == METHODTYPE_NO_STREAMING) { if (method_type == METHODTYPE_NO_STREAMING) {
method_name += "Async"; // prevent name clash with synchronous method. method_name += "Async"; // prevent name clash with synchronous method.
} }
GenerateDocCommentBody(out, method);
out->Print( out->Print(
"$returntype$ $methodname$($request_maybe$Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));\n", "$returntype$ $methodname$($request_maybe$Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));\n",
"methodname", method_name, "request_maybe", "methodname", method_name, "request_maybe",
...@@ -291,6 +346,7 @@ void GenerateClientInterface(Printer* out, const ServiceDescriptor *service) { ...@@ -291,6 +346,7 @@ void GenerateClientInterface(Printer* out, const ServiceDescriptor *service) {
GetMethodReturnTypeClient(method)); GetMethodReturnTypeClient(method));
// overload taking CallOptions as a param // overload taking CallOptions as a param
GenerateDocCommentBody(out, method);
out->Print( out->Print(
"$returntype$ $methodname$($request_maybe$CallOptions options);\n", "$returntype$ $methodname$($request_maybe$CallOptions options);\n",
"methodname", method_name, "request_maybe", "methodname", method_name, "request_maybe",
...@@ -303,7 +359,8 @@ void GenerateClientInterface(Printer* out, const ServiceDescriptor *service) { ...@@ -303,7 +359,8 @@ void GenerateClientInterface(Printer* out, const ServiceDescriptor *service) {
} }
void GenerateServerInterface(Printer* out, const ServiceDescriptor *service) { void GenerateServerInterface(Printer* out, const ServiceDescriptor *service) {
out->Print("// server-side interface\n"); out->Print("/// <summary>Interface of server-side implementations of $servicename$</summary>\n",
"servicename", GetServiceClassName(service));
out->Print("[System.Obsolete(\"Service implementations should inherit" out->Print("[System.Obsolete(\"Service implementations should inherit"
" from the generated abstract base class instead.\")]\n"); " from the generated abstract base class instead.\")]\n");
out->Print("public interface $name$\n", "name", out->Print("public interface $name$\n", "name",
...@@ -312,6 +369,7 @@ void GenerateServerInterface(Printer* out, const ServiceDescriptor *service) { ...@@ -312,6 +369,7 @@ void GenerateServerInterface(Printer* out, const ServiceDescriptor *service) {
out->Indent(); out->Indent();
for (int i = 0; i < service->method_count(); i++) { for (int i = 0; i < service->method_count(); i++) {
const MethodDescriptor *method = service->method(i); const MethodDescriptor *method = service->method(i);
GenerateDocCommentBody(out, method);
out->Print( out->Print(
"$returntype$ $methodname$($request$$response_stream_maybe$, " "$returntype$ $methodname$($request$$response_stream_maybe$, "
"ServerCallContext context);\n", "ServerCallContext context);\n",
...@@ -326,13 +384,15 @@ void GenerateServerInterface(Printer* out, const ServiceDescriptor *service) { ...@@ -326,13 +384,15 @@ void GenerateServerInterface(Printer* out, const ServiceDescriptor *service) {
} }
void GenerateServerClass(Printer* out, const ServiceDescriptor *service) { void GenerateServerClass(Printer* out, const ServiceDescriptor *service) {
out->Print("// server-side abstract class\n"); out->Print("/// <summary>Base class for server-side implementations of $servicename$</summary>\n",
"servicename", GetServiceClassName(service));
out->Print("public abstract class $name$\n", "name", out->Print("public abstract class $name$\n", "name",
GetServerClassName(service)); GetServerClassName(service));
out->Print("{\n"); out->Print("{\n");
out->Indent(); out->Indent();
for (int i = 0; i < service->method_count(); i++) { for (int i = 0; i < service->method_count(); i++) {
const MethodDescriptor *method = service->method(i); const MethodDescriptor *method = service->method(i);
GenerateDocCommentBody(out, method);
out->Print( out->Print(
"public virtual $returntype$ $methodname$($request$$response_stream_maybe$, " "public virtual $returntype$ $methodname$($request$$response_stream_maybe$, "
"ServerCallContext context)\n", "ServerCallContext context)\n",
...@@ -353,7 +413,8 @@ void GenerateServerClass(Printer* out, const ServiceDescriptor *service) { ...@@ -353,7 +413,8 @@ void GenerateServerClass(Printer* out, const ServiceDescriptor *service) {
} }
void GenerateClientStub(Printer* out, const ServiceDescriptor *service) { void GenerateClientStub(Printer* out, const ServiceDescriptor *service) {
out->Print("// client stub\n"); out->Print("/// <summary>Client for $servicename$</summary>\n",
"servicename", GetServiceClassName(service));
out->Print("#pragma warning disable 0618\n"); out->Print("#pragma warning disable 0618\n");
out->Print( out->Print(
"public class $name$ : ClientBase<$name$>, $interface$\n", "public class $name$ : ClientBase<$name$>, $interface$\n",
...@@ -392,6 +453,7 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor *service) { ...@@ -392,6 +453,7 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor *service) {
if (method_type == METHODTYPE_NO_STREAMING) { if (method_type == METHODTYPE_NO_STREAMING) {
// unary calls have an extra synchronous stub method // unary calls have an extra synchronous stub method
GenerateDocCommentBody(out, method);
out->Print("public virtual $response$ $methodname$($request$ request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))\n", out->Print("public virtual $response$ $methodname$($request$ request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))\n",
"methodname", method->name(), "request", "methodname", method->name(), "request",
GetClassName(method->input_type()), "response", GetClassName(method->input_type()), "response",
...@@ -404,6 +466,7 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor *service) { ...@@ -404,6 +466,7 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor *service) {
out->Print("}\n"); out->Print("}\n");
// overload taking CallOptions as a param // overload taking CallOptions as a param
GenerateDocCommentBody(out, method);
out->Print("public virtual $response$ $methodname$($request$ request, CallOptions options)\n", out->Print("public virtual $response$ $methodname$($request$ request, CallOptions options)\n",
"methodname", method->name(), "request", "methodname", method->name(), "request",
GetClassName(method->input_type()), "response", GetClassName(method->input_type()), "response",
...@@ -420,6 +483,7 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor *service) { ...@@ -420,6 +483,7 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor *service) {
if (method_type == METHODTYPE_NO_STREAMING) { if (method_type == METHODTYPE_NO_STREAMING) {
method_name += "Async"; // prevent name clash with synchronous method. method_name += "Async"; // prevent name clash with synchronous method.
} }
GenerateDocCommentBody(out, method);
out->Print( out->Print(
"public virtual $returntype$ $methodname$($request_maybe$Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))\n", "public virtual $returntype$ $methodname$($request_maybe$Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))\n",
"methodname", method_name, "request_maybe", "methodname", method_name, "request_maybe",
...@@ -435,6 +499,7 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor *service) { ...@@ -435,6 +499,7 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor *service) {
out->Print("}\n"); out->Print("}\n");
// overload taking CallOptions as a param // overload taking CallOptions as a param
GenerateDocCommentBody(out, method);
out->Print( out->Print(
"public virtual $returntype$ $methodname$($request_maybe$CallOptions options)\n", "public virtual $returntype$ $methodname$($request_maybe$CallOptions options)\n",
"methodname", method_name, "request_maybe", "methodname", method_name, "request_maybe",
...@@ -485,7 +550,7 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor *service) { ...@@ -485,7 +550,7 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor *service) {
void GenerateBindServiceMethod(Printer* out, const ServiceDescriptor *service, void GenerateBindServiceMethod(Printer* out, const ServiceDescriptor *service,
bool use_server_class) { bool use_server_class) {
out->Print( out->Print(
"// creates service definition that can be registered with a server\n"); "/// <summary>Creates service definition that can be registered with a server</summary>\n");
out->Print("#pragma warning disable 0618\n"); out->Print("#pragma warning disable 0618\n");
out->Print( out->Print(
"public static ServerServiceDefinition BindService($interface$ serviceImpl)\n", "public static ServerServiceDefinition BindService($interface$ serviceImpl)\n",
...@@ -519,7 +584,8 @@ void GenerateBindServiceMethod(Printer* out, const ServiceDescriptor *service, ...@@ -519,7 +584,8 @@ void GenerateBindServiceMethod(Printer* out, const ServiceDescriptor *service,
} }
void GenerateNewStubMethods(Printer* out, const ServiceDescriptor *service) { void GenerateNewStubMethods(Printer* out, const ServiceDescriptor *service) {
out->Print("// creates a new client\n"); out->Print("/// <summary>Creates a new client for $servicename$</summary>\n",
"servicename", GetServiceClassName(service));
out->Print("public static $classname$ NewClient(Channel channel)\n", out->Print("public static $classname$ NewClient(Channel channel)\n",
"classname", GetClientClassName(service)); "classname", GetClientClassName(service));
out->Print("{\n"); out->Print("{\n");
...@@ -534,6 +600,7 @@ void GenerateNewStubMethods(Printer* out, const ServiceDescriptor *service) { ...@@ -534,6 +600,7 @@ void GenerateNewStubMethods(Printer* out, const ServiceDescriptor *service) {
void GenerateService(Printer* out, const ServiceDescriptor *service, void GenerateService(Printer* out, const ServiceDescriptor *service,
bool generate_client, bool generate_server, bool generate_client, bool generate_server,
bool internal_access) { bool internal_access) {
GenerateDocCommentBody(out, service);
out->Print("$access_level$ static class $classname$\n", "access_level", out->Print("$access_level$ static class $classname$\n", "access_level",
GetAccessLevel(internal_access), "classname", GetAccessLevel(internal_access), "classname",
GetServiceClassName(service)); GetServiceClassName(service));
...@@ -590,6 +657,14 @@ grpc::string GetServices(const FileDescriptor *file, bool generate_client, ...@@ -590,6 +657,14 @@ grpc::string GetServices(const FileDescriptor *file, bool generate_client,
// Write out a file header. // Write out a file header.
out.Print("// Generated by the protocol buffer compiler. DO NOT EDIT!\n"); out.Print("// Generated by the protocol buffer compiler. DO NOT EDIT!\n");
out.Print("// source: $filename$\n", "filename", file->name()); out.Print("// source: $filename$\n", "filename", file->name());
// use C++ style as there are no file-level XML comments in .NET
grpc::string leading_comments = GetCppComments(file, true);
if (!leading_comments.empty()) {
out.Print("// Original file comments:\n");
out.Print(leading_comments.c_str());
}
out.Print("#region Designer generated code\n"); out.Print("#region Designer generated code\n");
out.Print("\n"); out.Print("\n");
out.Print("using System;\n"); out.Print("using System;\n");
......
// Generated by the protocol buffer compiler. DO NOT EDIT! // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: math.proto // source: math.proto
// Original file comments:
// Copyright 2015, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
#region Designer generated code #region Designer generated code
using System; using System;
...@@ -45,56 +75,140 @@ namespace Math { ...@@ -45,56 +75,140 @@ namespace Math {
__Marshaller_Num, __Marshaller_Num,
__Marshaller_Num); __Marshaller_Num);
// service descriptor /// <summary>Service descriptor</summary>
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{ {
get { return global::Math.MathReflection.Descriptor.Services[0]; } get { return global::Math.MathReflection.Descriptor.Services[0]; }
} }
// client interface /// <summary>Client for Math</summary>
[System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")] [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")]
public interface IMathClient public interface IMathClient
{ {
/// <summary>
/// Div divides args.dividend by args.divisor and returns the quotient and
/// remainder.
/// </summary>
global::Math.DivReply Div(global::Math.DivArgs request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); global::Math.DivReply Div(global::Math.DivArgs request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Div divides args.dividend by args.divisor and returns the quotient and
/// remainder.
/// </summary>
global::Math.DivReply Div(global::Math.DivArgs request, CallOptions options); global::Math.DivReply Div(global::Math.DivArgs request, CallOptions options);
/// <summary>
/// Div divides args.dividend by args.divisor and returns the quotient and
/// remainder.
/// </summary>
AsyncUnaryCall<global::Math.DivReply> DivAsync(global::Math.DivArgs request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); AsyncUnaryCall<global::Math.DivReply> DivAsync(global::Math.DivArgs request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Div divides args.dividend by args.divisor and returns the quotient and
/// remainder.
/// </summary>
AsyncUnaryCall<global::Math.DivReply> DivAsync(global::Math.DivArgs request, CallOptions options); AsyncUnaryCall<global::Math.DivReply> DivAsync(global::Math.DivArgs request, CallOptions options);
/// <summary>
/// DivMany accepts an arbitrary number of division args from the client stream
/// and sends back the results in the reply stream. The stream continues until
/// the client closes its end; the server does the same after sending all the
/// replies. The stream ends immediately if either end aborts.
/// </summary>
AsyncDuplexStreamingCall<global::Math.DivArgs, global::Math.DivReply> DivMany(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); AsyncDuplexStreamingCall<global::Math.DivArgs, global::Math.DivReply> DivMany(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// DivMany accepts an arbitrary number of division args from the client stream
/// and sends back the results in the reply stream. The stream continues until
/// the client closes its end; the server does the same after sending all the
/// replies. The stream ends immediately if either end aborts.
/// </summary>
AsyncDuplexStreamingCall<global::Math.DivArgs, global::Math.DivReply> DivMany(CallOptions options); AsyncDuplexStreamingCall<global::Math.DivArgs, global::Math.DivReply> DivMany(CallOptions options);
/// <summary>
/// Fib generates numbers in the Fibonacci sequence. If args.limit > 0, Fib
/// generates up to limit numbers; otherwise it continues until the call is
/// canceled. Unlike Fib above, Fib has no final FibReply.
/// </summary>
AsyncServerStreamingCall<global::Math.Num> Fib(global::Math.FibArgs request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); AsyncServerStreamingCall<global::Math.Num> Fib(global::Math.FibArgs request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Fib generates numbers in the Fibonacci sequence. If args.limit > 0, Fib
/// generates up to limit numbers; otherwise it continues until the call is
/// canceled. Unlike Fib above, Fib has no final FibReply.
/// </summary>
AsyncServerStreamingCall<global::Math.Num> Fib(global::Math.FibArgs request, CallOptions options); AsyncServerStreamingCall<global::Math.Num> Fib(global::Math.FibArgs request, CallOptions options);
/// <summary>
/// Sum sums a stream of numbers, returning the final result once the stream
/// is closed.
/// </summary>
AsyncClientStreamingCall<global::Math.Num, global::Math.Num> Sum(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); AsyncClientStreamingCall<global::Math.Num, global::Math.Num> Sum(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Sum sums a stream of numbers, returning the final result once the stream
/// is closed.
/// </summary>
AsyncClientStreamingCall<global::Math.Num, global::Math.Num> Sum(CallOptions options); AsyncClientStreamingCall<global::Math.Num, global::Math.Num> Sum(CallOptions options);
} }
// server-side interface /// <summary>Interface of server-side implementations of Math</summary>
[System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")] [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")]
public interface IMath public interface IMath
{ {
/// <summary>
/// Div divides args.dividend by args.divisor and returns the quotient and
/// remainder.
/// </summary>
Task<global::Math.DivReply> Div(global::Math.DivArgs request, ServerCallContext context); Task<global::Math.DivReply> Div(global::Math.DivArgs request, ServerCallContext context);
/// <summary>
/// DivMany accepts an arbitrary number of division args from the client stream
/// and sends back the results in the reply stream. The stream continues until
/// the client closes its end; the server does the same after sending all the
/// replies. The stream ends immediately if either end aborts.
/// </summary>
Task DivMany(IAsyncStreamReader<global::Math.DivArgs> requestStream, IServerStreamWriter<global::Math.DivReply> responseStream, ServerCallContext context); Task DivMany(IAsyncStreamReader<global::Math.DivArgs> requestStream, IServerStreamWriter<global::Math.DivReply> responseStream, ServerCallContext context);
/// <summary>
/// Fib generates numbers in the Fibonacci sequence. If args.limit > 0, Fib
/// generates up to limit numbers; otherwise it continues until the call is
/// canceled. Unlike Fib above, Fib has no final FibReply.
/// </summary>
Task Fib(global::Math.FibArgs request, IServerStreamWriter<global::Math.Num> responseStream, ServerCallContext context); Task Fib(global::Math.FibArgs request, IServerStreamWriter<global::Math.Num> responseStream, ServerCallContext context);
/// <summary>
/// Sum sums a stream of numbers, returning the final result once the stream
/// is closed.
/// </summary>
Task<global::Math.Num> Sum(IAsyncStreamReader<global::Math.Num> requestStream, ServerCallContext context); Task<global::Math.Num> Sum(IAsyncStreamReader<global::Math.Num> requestStream, ServerCallContext context);
} }
// server-side abstract class /// <summary>Base class for server-side implementations of Math</summary>
public abstract class MathBase public abstract class MathBase
{ {
/// <summary>
/// Div divides args.dividend by args.divisor and returns the quotient and
/// remainder.
/// </summary>
public virtual Task<global::Math.DivReply> Div(global::Math.DivArgs request, ServerCallContext context) public virtual Task<global::Math.DivReply> Div(global::Math.DivArgs request, ServerCallContext context)
{ {
throw new RpcException(new Status(StatusCode.Unimplemented, "")); throw new RpcException(new Status(StatusCode.Unimplemented, ""));
} }
/// <summary>
/// DivMany accepts an arbitrary number of division args from the client stream
/// and sends back the results in the reply stream. The stream continues until
/// the client closes its end; the server does the same after sending all the
/// replies. The stream ends immediately if either end aborts.
/// </summary>
public virtual Task DivMany(IAsyncStreamReader<global::Math.DivArgs> requestStream, IServerStreamWriter<global::Math.DivReply> responseStream, ServerCallContext context) public virtual Task DivMany(IAsyncStreamReader<global::Math.DivArgs> requestStream, IServerStreamWriter<global::Math.DivReply> responseStream, ServerCallContext context)
{ {
throw new RpcException(new Status(StatusCode.Unimplemented, "")); throw new RpcException(new Status(StatusCode.Unimplemented, ""));
} }
/// <summary>
/// Fib generates numbers in the Fibonacci sequence. If args.limit > 0, Fib
/// generates up to limit numbers; otherwise it continues until the call is
/// canceled. Unlike Fib above, Fib has no final FibReply.
/// </summary>
public virtual Task Fib(global::Math.FibArgs request, IServerStreamWriter<global::Math.Num> responseStream, ServerCallContext context) public virtual Task Fib(global::Math.FibArgs request, IServerStreamWriter<global::Math.Num> responseStream, ServerCallContext context)
{ {
throw new RpcException(new Status(StatusCode.Unimplemented, "")); throw new RpcException(new Status(StatusCode.Unimplemented, ""));
} }
/// <summary>
/// Sum sums a stream of numbers, returning the final result once the stream
/// is closed.
/// </summary>
public virtual Task<global::Math.Num> Sum(IAsyncStreamReader<global::Math.Num> requestStream, ServerCallContext context) public virtual Task<global::Math.Num> Sum(IAsyncStreamReader<global::Math.Num> requestStream, ServerCallContext context)
{ {
throw new RpcException(new Status(StatusCode.Unimplemented, "")); throw new RpcException(new Status(StatusCode.Unimplemented, ""));
...@@ -102,7 +216,7 @@ namespace Math { ...@@ -102,7 +216,7 @@ namespace Math {
} }
// client stub /// <summary>Client for Math</summary>
#pragma warning disable 0618 #pragma warning disable 0618
public class MathClient : ClientBase<MathClient>, IMathClient public class MathClient : ClientBase<MathClient>, IMathClient
#pragma warning restore 0618 #pragma warning restore 0618
...@@ -122,42 +236,88 @@ namespace Math { ...@@ -122,42 +236,88 @@ namespace Math {
{ {
} }
/// <summary>
/// Div divides args.dividend by args.divisor and returns the quotient and
/// remainder.
/// </summary>
public virtual global::Math.DivReply Div(global::Math.DivArgs request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual global::Math.DivReply Div(global::Math.DivArgs request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return Div(request, new CallOptions(headers, deadline, cancellationToken)); return Div(request, new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary>
/// Div divides args.dividend by args.divisor and returns the quotient and
/// remainder.
/// </summary>
public virtual global::Math.DivReply Div(global::Math.DivArgs request, CallOptions options) public virtual global::Math.DivReply Div(global::Math.DivArgs request, CallOptions options)
{ {
return CallInvoker.BlockingUnaryCall(__Method_Div, null, options, request); return CallInvoker.BlockingUnaryCall(__Method_Div, null, options, request);
} }
/// <summary>
/// Div divides args.dividend by args.divisor and returns the quotient and
/// remainder.
/// </summary>
public virtual AsyncUnaryCall<global::Math.DivReply> DivAsync(global::Math.DivArgs request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual AsyncUnaryCall<global::Math.DivReply> DivAsync(global::Math.DivArgs request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return DivAsync(request, new CallOptions(headers, deadline, cancellationToken)); return DivAsync(request, new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary>
/// Div divides args.dividend by args.divisor and returns the quotient and
/// remainder.
/// </summary>
public virtual AsyncUnaryCall<global::Math.DivReply> DivAsync(global::Math.DivArgs request, CallOptions options) public virtual AsyncUnaryCall<global::Math.DivReply> DivAsync(global::Math.DivArgs request, CallOptions options)
{ {
return CallInvoker.AsyncUnaryCall(__Method_Div, null, options, request); return CallInvoker.AsyncUnaryCall(__Method_Div, null, options, request);
} }
/// <summary>
/// DivMany accepts an arbitrary number of division args from the client stream
/// and sends back the results in the reply stream. The stream continues until
/// the client closes its end; the server does the same after sending all the
/// replies. The stream ends immediately if either end aborts.
/// </summary>
public virtual AsyncDuplexStreamingCall<global::Math.DivArgs, global::Math.DivReply> DivMany(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual AsyncDuplexStreamingCall<global::Math.DivArgs, global::Math.DivReply> DivMany(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return DivMany(new CallOptions(headers, deadline, cancellationToken)); return DivMany(new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary>
/// DivMany accepts an arbitrary number of division args from the client stream
/// and sends back the results in the reply stream. The stream continues until
/// the client closes its end; the server does the same after sending all the
/// replies. The stream ends immediately if either end aborts.
/// </summary>
public virtual AsyncDuplexStreamingCall<global::Math.DivArgs, global::Math.DivReply> DivMany(CallOptions options) public virtual AsyncDuplexStreamingCall<global::Math.DivArgs, global::Math.DivReply> DivMany(CallOptions options)
{ {
return CallInvoker.AsyncDuplexStreamingCall(__Method_DivMany, null, options); return CallInvoker.AsyncDuplexStreamingCall(__Method_DivMany, null, options);
} }
/// <summary>
/// Fib generates numbers in the Fibonacci sequence. If args.limit > 0, Fib
/// generates up to limit numbers; otherwise it continues until the call is
/// canceled. Unlike Fib above, Fib has no final FibReply.
/// </summary>
public virtual AsyncServerStreamingCall<global::Math.Num> Fib(global::Math.FibArgs request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual AsyncServerStreamingCall<global::Math.Num> Fib(global::Math.FibArgs request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return Fib(request, new CallOptions(headers, deadline, cancellationToken)); return Fib(request, new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary>
/// Fib generates numbers in the Fibonacci sequence. If args.limit > 0, Fib
/// generates up to limit numbers; otherwise it continues until the call is
/// canceled. Unlike Fib above, Fib has no final FibReply.
/// </summary>
public virtual AsyncServerStreamingCall<global::Math.Num> Fib(global::Math.FibArgs request, CallOptions options) public virtual AsyncServerStreamingCall<global::Math.Num> Fib(global::Math.FibArgs request, CallOptions options)
{ {
return CallInvoker.AsyncServerStreamingCall(__Method_Fib, null, options, request); return CallInvoker.AsyncServerStreamingCall(__Method_Fib, null, options, request);
} }
/// <summary>
/// Sum sums a stream of numbers, returning the final result once the stream
/// is closed.
/// </summary>
public virtual AsyncClientStreamingCall<global::Math.Num, global::Math.Num> Sum(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual AsyncClientStreamingCall<global::Math.Num, global::Math.Num> Sum(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return Sum(new CallOptions(headers, deadline, cancellationToken)); return Sum(new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary>
/// Sum sums a stream of numbers, returning the final result once the stream
/// is closed.
/// </summary>
public virtual AsyncClientStreamingCall<global::Math.Num, global::Math.Num> Sum(CallOptions options) public virtual AsyncClientStreamingCall<global::Math.Num, global::Math.Num> Sum(CallOptions options)
{ {
return CallInvoker.AsyncClientStreamingCall(__Method_Sum, null, options); return CallInvoker.AsyncClientStreamingCall(__Method_Sum, null, options);
...@@ -168,13 +328,13 @@ namespace Math { ...@@ -168,13 +328,13 @@ namespace Math {
} }
} }
// creates a new client /// <summary>Creates a new client for Math</summary>
public static MathClient NewClient(Channel channel) public static MathClient NewClient(Channel channel)
{ {
return new MathClient(channel); return new MathClient(channel);
} }
// creates service definition that can be registered with a server /// <summary>Creates service definition that can be registered with a server</summary>
#pragma warning disable 0618 #pragma warning disable 0618
public static ServerServiceDefinition BindService(IMath serviceImpl) public static ServerServiceDefinition BindService(IMath serviceImpl)
#pragma warning restore 0618 #pragma warning restore 0618
...@@ -186,7 +346,7 @@ namespace Math { ...@@ -186,7 +346,7 @@ namespace Math {
.AddMethod(__Method_Sum, serviceImpl.Sum).Build(); .AddMethod(__Method_Sum, serviceImpl.Sum).Build();
} }
// creates service definition that can be registered with a server /// <summary>Creates service definition that can be registered with a server</summary>
#pragma warning disable 0618 #pragma warning disable 0618
public static ServerServiceDefinition BindService(MathBase serviceImpl) public static ServerServiceDefinition BindService(MathBase serviceImpl)
#pragma warning restore 0618 #pragma warning restore 0618
......
// Generated by the protocol buffer compiler. DO NOT EDIT! // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: health.proto // source: health.proto
// Original file comments:
// Copyright 2015, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
#region Designer generated code #region Designer generated code
using System; using System;
...@@ -22,13 +52,13 @@ namespace Grpc.Health.V1 { ...@@ -22,13 +52,13 @@ namespace Grpc.Health.V1 {
__Marshaller_HealthCheckRequest, __Marshaller_HealthCheckRequest,
__Marshaller_HealthCheckResponse); __Marshaller_HealthCheckResponse);
// service descriptor /// <summary>Service descriptor</summary>
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{ {
get { return global::Grpc.Health.V1.HealthReflection.Descriptor.Services[0]; } get { return global::Grpc.Health.V1.HealthReflection.Descriptor.Services[0]; }
} }
// client interface /// <summary>Client for Health</summary>
[System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")] [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")]
public interface IHealthClient public interface IHealthClient
{ {
...@@ -38,14 +68,14 @@ namespace Grpc.Health.V1 { ...@@ -38,14 +68,14 @@ namespace Grpc.Health.V1 {
AsyncUnaryCall<global::Grpc.Health.V1.HealthCheckResponse> CheckAsync(global::Grpc.Health.V1.HealthCheckRequest request, CallOptions options); AsyncUnaryCall<global::Grpc.Health.V1.HealthCheckResponse> CheckAsync(global::Grpc.Health.V1.HealthCheckRequest request, CallOptions options);
} }
// server-side interface /// <summary>Interface of server-side implementations of Health</summary>
[System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")] [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")]
public interface IHealth public interface IHealth
{ {
Task<global::Grpc.Health.V1.HealthCheckResponse> Check(global::Grpc.Health.V1.HealthCheckRequest request, ServerCallContext context); Task<global::Grpc.Health.V1.HealthCheckResponse> Check(global::Grpc.Health.V1.HealthCheckRequest request, ServerCallContext context);
} }
// server-side abstract class /// <summary>Base class for server-side implementations of Health</summary>
public abstract class HealthBase public abstract class HealthBase
{ {
public virtual Task<global::Grpc.Health.V1.HealthCheckResponse> Check(global::Grpc.Health.V1.HealthCheckRequest request, ServerCallContext context) public virtual Task<global::Grpc.Health.V1.HealthCheckResponse> Check(global::Grpc.Health.V1.HealthCheckRequest request, ServerCallContext context)
...@@ -55,7 +85,7 @@ namespace Grpc.Health.V1 { ...@@ -55,7 +85,7 @@ namespace Grpc.Health.V1 {
} }
// client stub /// <summary>Client for Health</summary>
#pragma warning disable 0618 #pragma warning disable 0618
public class HealthClient : ClientBase<HealthClient>, IHealthClient public class HealthClient : ClientBase<HealthClient>, IHealthClient
#pragma warning restore 0618 #pragma warning restore 0618
...@@ -97,13 +127,13 @@ namespace Grpc.Health.V1 { ...@@ -97,13 +127,13 @@ namespace Grpc.Health.V1 {
} }
} }
// creates a new client /// <summary>Creates a new client for Health</summary>
public static HealthClient NewClient(Channel channel) public static HealthClient NewClient(Channel channel)
{ {
return new HealthClient(channel); return new HealthClient(channel);
} }
// creates service definition that can be registered with a server /// <summary>Creates service definition that can be registered with a server</summary>
#pragma warning disable 0618 #pragma warning disable 0618
public static ServerServiceDefinition BindService(IHealth serviceImpl) public static ServerServiceDefinition BindService(IHealth serviceImpl)
#pragma warning restore 0618 #pragma warning restore 0618
...@@ -112,7 +142,7 @@ namespace Grpc.Health.V1 { ...@@ -112,7 +142,7 @@ namespace Grpc.Health.V1 {
.AddMethod(__Method_Check, serviceImpl.Check).Build(); .AddMethod(__Method_Check, serviceImpl.Check).Build();
} }
// creates service definition that can be registered with a server /// <summary>Creates service definition that can be registered with a server</summary>
#pragma warning disable 0618 #pragma warning disable 0618
public static ServerServiceDefinition BindService(HealthBase serviceImpl) public static ServerServiceDefinition BindService(HealthBase serviceImpl)
#pragma warning restore 0618 #pragma warning restore 0618
......
// Generated by the protocol buffer compiler. DO NOT EDIT! // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: src/proto/grpc/testing/metrics.proto // source: src/proto/grpc/testing/metrics.proto
// Original file comments:
// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Contains the definitions for a metrics service and the type of metrics
// exposed by the service.
//
// Currently, 'Gauge' (i.e a metric that represents the measured value of
// something at an instant of time) is the only metric type supported by the
// service.
#region Designer generated code #region Designer generated code
using System; using System;
...@@ -30,40 +66,74 @@ namespace Grpc.Testing { ...@@ -30,40 +66,74 @@ namespace Grpc.Testing {
__Marshaller_GaugeRequest, __Marshaller_GaugeRequest,
__Marshaller_GaugeResponse); __Marshaller_GaugeResponse);
// service descriptor /// <summary>Service descriptor</summary>
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{ {
get { return global::Grpc.Testing.MetricsReflection.Descriptor.Services[0]; } get { return global::Grpc.Testing.MetricsReflection.Descriptor.Services[0]; }
} }
// client interface /// <summary>Client for MetricsService</summary>
[System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")] [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")]
public interface IMetricsServiceClient public interface IMetricsServiceClient
{ {
/// <summary>
/// Returns the values of all the gauges that are currently being maintained by
/// the service
/// </summary>
AsyncServerStreamingCall<global::Grpc.Testing.GaugeResponse> GetAllGauges(global::Grpc.Testing.EmptyMessage request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); AsyncServerStreamingCall<global::Grpc.Testing.GaugeResponse> GetAllGauges(global::Grpc.Testing.EmptyMessage request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Returns the values of all the gauges that are currently being maintained by
/// the service
/// </summary>
AsyncServerStreamingCall<global::Grpc.Testing.GaugeResponse> GetAllGauges(global::Grpc.Testing.EmptyMessage request, CallOptions options); AsyncServerStreamingCall<global::Grpc.Testing.GaugeResponse> GetAllGauges(global::Grpc.Testing.EmptyMessage request, CallOptions options);
/// <summary>
/// Returns the value of one gauge
/// </summary>
global::Grpc.Testing.GaugeResponse GetGauge(global::Grpc.Testing.GaugeRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); global::Grpc.Testing.GaugeResponse GetGauge(global::Grpc.Testing.GaugeRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Returns the value of one gauge
/// </summary>
global::Grpc.Testing.GaugeResponse GetGauge(global::Grpc.Testing.GaugeRequest request, CallOptions options); global::Grpc.Testing.GaugeResponse GetGauge(global::Grpc.Testing.GaugeRequest request, CallOptions options);
/// <summary>
/// Returns the value of one gauge
/// </summary>
AsyncUnaryCall<global::Grpc.Testing.GaugeResponse> GetGaugeAsync(global::Grpc.Testing.GaugeRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); AsyncUnaryCall<global::Grpc.Testing.GaugeResponse> GetGaugeAsync(global::Grpc.Testing.GaugeRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Returns the value of one gauge
/// </summary>
AsyncUnaryCall<global::Grpc.Testing.GaugeResponse> GetGaugeAsync(global::Grpc.Testing.GaugeRequest request, CallOptions options); AsyncUnaryCall<global::Grpc.Testing.GaugeResponse> GetGaugeAsync(global::Grpc.Testing.GaugeRequest request, CallOptions options);
} }
// server-side interface /// <summary>Interface of server-side implementations of MetricsService</summary>
[System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")] [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")]
public interface IMetricsService public interface IMetricsService
{ {
/// <summary>
/// Returns the values of all the gauges that are currently being maintained by
/// the service
/// </summary>
Task GetAllGauges(global::Grpc.Testing.EmptyMessage request, IServerStreamWriter<global::Grpc.Testing.GaugeResponse> responseStream, ServerCallContext context); Task GetAllGauges(global::Grpc.Testing.EmptyMessage request, IServerStreamWriter<global::Grpc.Testing.GaugeResponse> responseStream, ServerCallContext context);
/// <summary>
/// Returns the value of one gauge
/// </summary>
Task<global::Grpc.Testing.GaugeResponse> GetGauge(global::Grpc.Testing.GaugeRequest request, ServerCallContext context); Task<global::Grpc.Testing.GaugeResponse> GetGauge(global::Grpc.Testing.GaugeRequest request, ServerCallContext context);
} }
// server-side abstract class /// <summary>Base class for server-side implementations of MetricsService</summary>
public abstract class MetricsServiceBase public abstract class MetricsServiceBase
{ {
/// <summary>
/// Returns the values of all the gauges that are currently being maintained by
/// the service
/// </summary>
public virtual Task GetAllGauges(global::Grpc.Testing.EmptyMessage request, IServerStreamWriter<global::Grpc.Testing.GaugeResponse> responseStream, ServerCallContext context) public virtual Task GetAllGauges(global::Grpc.Testing.EmptyMessage request, IServerStreamWriter<global::Grpc.Testing.GaugeResponse> responseStream, ServerCallContext context)
{ {
throw new RpcException(new Status(StatusCode.Unimplemented, "")); throw new RpcException(new Status(StatusCode.Unimplemented, ""));
} }
/// <summary>
/// Returns the value of one gauge
/// </summary>
public virtual Task<global::Grpc.Testing.GaugeResponse> GetGauge(global::Grpc.Testing.GaugeRequest request, ServerCallContext context) public virtual Task<global::Grpc.Testing.GaugeResponse> GetGauge(global::Grpc.Testing.GaugeRequest request, ServerCallContext context)
{ {
throw new RpcException(new Status(StatusCode.Unimplemented, "")); throw new RpcException(new Status(StatusCode.Unimplemented, ""));
...@@ -71,7 +141,7 @@ namespace Grpc.Testing { ...@@ -71,7 +141,7 @@ namespace Grpc.Testing {
} }
// client stub /// <summary>Client for MetricsService</summary>
#pragma warning disable 0618 #pragma warning disable 0618
public class MetricsServiceClient : ClientBase<MetricsServiceClient>, IMetricsServiceClient public class MetricsServiceClient : ClientBase<MetricsServiceClient>, IMetricsServiceClient
#pragma warning restore 0618 #pragma warning restore 0618
...@@ -91,26 +161,46 @@ namespace Grpc.Testing { ...@@ -91,26 +161,46 @@ namespace Grpc.Testing {
{ {
} }
/// <summary>
/// Returns the values of all the gauges that are currently being maintained by
/// the service
/// </summary>
public virtual AsyncServerStreamingCall<global::Grpc.Testing.GaugeResponse> GetAllGauges(global::Grpc.Testing.EmptyMessage request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual AsyncServerStreamingCall<global::Grpc.Testing.GaugeResponse> GetAllGauges(global::Grpc.Testing.EmptyMessage request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetAllGauges(request, new CallOptions(headers, deadline, cancellationToken)); return GetAllGauges(request, new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary>
/// Returns the values of all the gauges that are currently being maintained by
/// the service
/// </summary>
public virtual AsyncServerStreamingCall<global::Grpc.Testing.GaugeResponse> GetAllGauges(global::Grpc.Testing.EmptyMessage request, CallOptions options) public virtual AsyncServerStreamingCall<global::Grpc.Testing.GaugeResponse> GetAllGauges(global::Grpc.Testing.EmptyMessage request, CallOptions options)
{ {
return CallInvoker.AsyncServerStreamingCall(__Method_GetAllGauges, null, options, request); return CallInvoker.AsyncServerStreamingCall(__Method_GetAllGauges, null, options, request);
} }
/// <summary>
/// Returns the value of one gauge
/// </summary>
public virtual global::Grpc.Testing.GaugeResponse GetGauge(global::Grpc.Testing.GaugeRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual global::Grpc.Testing.GaugeResponse GetGauge(global::Grpc.Testing.GaugeRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetGauge(request, new CallOptions(headers, deadline, cancellationToken)); return GetGauge(request, new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary>
/// Returns the value of one gauge
/// </summary>
public virtual global::Grpc.Testing.GaugeResponse GetGauge(global::Grpc.Testing.GaugeRequest request, CallOptions options) public virtual global::Grpc.Testing.GaugeResponse GetGauge(global::Grpc.Testing.GaugeRequest request, CallOptions options)
{ {
return CallInvoker.BlockingUnaryCall(__Method_GetGauge, null, options, request); return CallInvoker.BlockingUnaryCall(__Method_GetGauge, null, options, request);
} }
/// <summary>
/// Returns the value of one gauge
/// </summary>
public virtual AsyncUnaryCall<global::Grpc.Testing.GaugeResponse> GetGaugeAsync(global::Grpc.Testing.GaugeRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual AsyncUnaryCall<global::Grpc.Testing.GaugeResponse> GetGaugeAsync(global::Grpc.Testing.GaugeRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return GetGaugeAsync(request, new CallOptions(headers, deadline, cancellationToken)); return GetGaugeAsync(request, new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary>
/// Returns the value of one gauge
/// </summary>
public virtual AsyncUnaryCall<global::Grpc.Testing.GaugeResponse> GetGaugeAsync(global::Grpc.Testing.GaugeRequest request, CallOptions options) public virtual AsyncUnaryCall<global::Grpc.Testing.GaugeResponse> GetGaugeAsync(global::Grpc.Testing.GaugeRequest request, CallOptions options)
{ {
return CallInvoker.AsyncUnaryCall(__Method_GetGauge, null, options, request); return CallInvoker.AsyncUnaryCall(__Method_GetGauge, null, options, request);
...@@ -121,13 +211,13 @@ namespace Grpc.Testing { ...@@ -121,13 +211,13 @@ namespace Grpc.Testing {
} }
} }
// creates a new client /// <summary>Creates a new client for MetricsService</summary>
public static MetricsServiceClient NewClient(Channel channel) public static MetricsServiceClient NewClient(Channel channel)
{ {
return new MetricsServiceClient(channel); return new MetricsServiceClient(channel);
} }
// creates service definition that can be registered with a server /// <summary>Creates service definition that can be registered with a server</summary>
#pragma warning disable 0618 #pragma warning disable 0618
public static ServerServiceDefinition BindService(IMetricsService serviceImpl) public static ServerServiceDefinition BindService(IMetricsService serviceImpl)
#pragma warning restore 0618 #pragma warning restore 0618
...@@ -137,7 +227,7 @@ namespace Grpc.Testing { ...@@ -137,7 +227,7 @@ namespace Grpc.Testing {
.AddMethod(__Method_GetGauge, serviceImpl.GetGauge).Build(); .AddMethod(__Method_GetGauge, serviceImpl.GetGauge).Build();
} }
// creates service definition that can be registered with a server /// <summary>Creates service definition that can be registered with a server</summary>
#pragma warning disable 0618 #pragma warning disable 0618
public static ServerServiceDefinition BindService(MetricsServiceBase serviceImpl) public static ServerServiceDefinition BindService(MetricsServiceBase serviceImpl)
#pragma warning restore 0618 #pragma warning restore 0618
......
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment