Merge branch 'client_channel_init_cleanup' into cpp_filter_api_cleanup

pull/9067/head
Mark D. Roth 8 years ago
commit 988501376b
  1. 2
      examples/cpp/helloworld/greeter_client.cc
  2. 2
      examples/python/multiplex/run_codegen.py
  3. 2
      examples/python/route_guide/run_codegen.py
  4. 91
      src/compiler/csharp_generator.cc
  5. 13
      src/core/ext/client_channel/client_channel.c
  6. 125
      src/csharp/Grpc.Examples/MathGrpc.cs
  7. 1
      src/csharp/Grpc.HealthCheck/HealthGrpc.cs
  8. 54
      src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs
  9. 213
      src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs
  10. 295
      src/csharp/Grpc.IntegrationTesting/TestGrpc.cs
  11. 23
      src/csharp/Grpc.Reflection/ReflectionGrpc.cs
  12. 52
      src/python/grpcio/grpc/__init__.py
  13. 88
      src/python/grpcio/grpc/_server.py
  14. 30
      src/python/grpcio_health_checking/grpc/__init__.py
  15. 0
      src/python/grpcio_health_checking/grpc_health/__init__.py
  16. 0
      src/python/grpcio_health_checking/grpc_health/v1/__init__.py
  17. 2
      src/python/grpcio_health_checking/grpc_health/v1/health.py
  18. 4
      src/python/grpcio_health_checking/health_commands.py
  19. 1
      src/python/grpcio_health_checking/setup.py
  20. 30
      src/python/grpcio_reflection/grpc/__init__.py
  21. 0
      src/python/grpcio_reflection/grpc_reflection/__init__.py
  22. 0
      src/python/grpcio_reflection/grpc_reflection/v1alpha/__init__.py
  23. 2
      src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py
  24. 4
      src/python/grpcio_reflection/reflection_commands.py
  25. 1
      src/python/grpcio_reflection/setup.py
  26. 4
      src/python/grpcio_tests/commands.py
  27. 4
      src/python/grpcio_tests/setup.py
  28. 6
      src/python/grpcio_tests/tests/health_check/_health_servicer_test.py
  29. 2
      src/python/grpcio_tests/tests/protoc_plugin/_split_definitions_test.py
  30. 6
      src/python/grpcio_tests/tests/reflection/_reflection_servicer_test.py
  31. 1
      src/python/grpcio_tests/tests/tests.json
  32. 23
      src/python/grpcio_tests/tests/unit/_exit_test.py
  33. 30
      tools/distrib/python/grpcio_tools/grpc/__init__.py
  34. 0
      tools/distrib/python/grpcio_tools/grpc_tools/__init__.py
  35. 2
      tools/distrib/python/grpcio_tools/grpc_tools/_protoc_compiler.pyx
  36. 4
      tools/distrib/python/grpcio_tools/grpc_tools/command.py
  37. 2
      tools/distrib/python/grpcio_tools/grpc_tools/main.cc
  38. 0
      tools/distrib/python/grpcio_tools/grpc_tools/main.h
  39. 2
      tools/distrib/python/grpcio_tools/grpc_tools/protoc.py
  40. 11
      tools/distrib/python/grpcio_tools/setup.py

@ -51,7 +51,7 @@ class GreeterClient {
GreeterClient(std::shared_ptr<Channel> channel) GreeterClient(std::shared_ptr<Channel> channel)
: stub_(Greeter::NewStub(channel)) {} : stub_(Greeter::NewStub(channel)) {}
// Assambles the client's payload, sends it and presents the response back // Assembles the client's payload, sends it and presents the response back
// from the server. // from the server.
std::string SayHello(const std::string& user) { std::string SayHello(const std::string& user) {
// Data we are sending to the server. // Data we are sending to the server.

@ -29,7 +29,7 @@
"""Generates protocol messages and gRPC stubs.""" """Generates protocol messages and gRPC stubs."""
from grpc.tools import protoc from grpc_tools import protoc
protoc.main( protoc.main(
( (

@ -29,7 +29,7 @@
"""Runs protoc with the gRPC plugin to generate messages and gRPC stubs.""" """Runs protoc with the gRPC plugin to generate messages and gRPC stubs."""
from grpc.tools import protoc from grpc_tools import protoc
protoc.main( protoc.main(
( (

@ -68,13 +68,13 @@ namespace {
// Currently, we cannot easily reuse the functionality as // Currently, we cannot easily reuse the functionality as
// google/protobuf/compiler/csharp/csharp_doc_comment.h is not a public header. // google/protobuf/compiler/csharp/csharp_doc_comment.h is not a public header.
// TODO(jtattermusch): reuse the functionality from google/protobuf. // TODO(jtattermusch): reuse the functionality from google/protobuf.
void GenerateDocCommentBodyImpl(grpc::protobuf::io::Printer *printer, bool GenerateDocCommentBodyImpl(grpc::protobuf::io::Printer *printer,
grpc::protobuf::SourceLocation location) { grpc::protobuf::SourceLocation location) {
grpc::string comments = location.leading_comments.empty() grpc::string comments = location.leading_comments.empty()
? location.trailing_comments ? location.trailing_comments
: location.leading_comments; : location.leading_comments;
if (comments.empty()) { if (comments.empty()) {
return; return false;
} }
// XML escaping... no need for apostrophes etc as the whole text is going to // XML escaping... no need for apostrophes etc as the whole text is going to
// be a child // be a child
@ -107,18 +107,84 @@ void GenerateDocCommentBodyImpl(grpc::protobuf::io::Printer *printer,
printer->Print("///\n"); printer->Print("///\n");
} }
last_was_empty = false; last_was_empty = false;
printer->Print("/// $line$\n", "line", *it); printer->Print("///$line$\n", "line", *it);
} }
} }
printer->Print("/// </summary>\n"); printer->Print("/// </summary>\n");
return true;
} }
template <typename DescriptorType> template <typename DescriptorType>
void GenerateDocCommentBody(grpc::protobuf::io::Printer *printer, bool GenerateDocCommentBody(grpc::protobuf::io::Printer *printer,
const DescriptorType *descriptor) { const DescriptorType *descriptor) {
grpc::protobuf::SourceLocation location; grpc::protobuf::SourceLocation location;
if (descriptor->GetSourceLocation(&location)) { if (!descriptor->GetSourceLocation(&location)) {
GenerateDocCommentBodyImpl(printer, location); return false;
}
return GenerateDocCommentBodyImpl(printer, location);
}
void GenerateDocCommentServerMethod(grpc::protobuf::io::Printer *printer,
const MethodDescriptor *method) {
if (GenerateDocCommentBody(printer, method)) {
if (method->client_streaming()) {
printer->Print(
"/// <param name=\"requestStream\">Used for reading requests from "
"the client.</param>\n");
} else {
printer->Print(
"/// <param name=\"request\">The request received from the "
"client.</param>\n");
}
if (method->server_streaming()) {
printer->Print(
"/// <param name=\"responseStream\">Used for sending responses back "
"to the client.</param>\n");
}
printer->Print(
"/// <param name=\"context\">The context of the server-side call "
"handler being invoked.</param>\n");
if (method->server_streaming()) {
printer->Print(
"/// <returns>A task indicating completion of the "
"handler.</returns>\n");
} else {
printer->Print(
"/// <returns>The response to send back to the client (wrapped by a "
"task).</returns>\n");
}
}
}
void GenerateDocCommentClientMethod(grpc::protobuf::io::Printer *printer,
const MethodDescriptor *method,
bool is_sync, bool use_call_options) {
if (GenerateDocCommentBody(printer, method)) {
if (!method->client_streaming()) {
printer->Print(
"/// <param name=\"request\">The request to send to the "
"server.</param>\n");
}
if (!use_call_options) {
printer->Print(
"/// <param name=\"headers\">The initial metadata to send with the "
"call. This parameter is optional.</param>\n");
printer->Print(
"/// <param name=\"deadline\">An optional deadline for the call. The "
"call will be cancelled if deadline is hit.</param>\n");
printer->Print(
"/// <param name=\"cancellationToken\">An optional token for "
"canceling the call.</param>\n");
} else {
printer->Print(
"/// <param name=\"options\">The options for the call.</param>\n");
}
if (is_sync) {
printer->Print(
"/// <returns>The response received from the server.</returns>\n");
} else {
printer->Print("/// <returns>The call object.</returns>\n");
}
} }
} }
@ -319,7 +385,7 @@ void GenerateServerClass(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); GenerateDocCommentServerMethod(out, method);
out->Print( out->Print(
"public virtual $returntype$ " "public virtual $returntype$ "
"$methodname$($request$$response_stream_maybe$, " "$methodname$($request$$response_stream_maybe$, "
@ -393,7 +459,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); GenerateDocCommentClientMethod(out, method, true, false);
out->Print( out->Print(
"public virtual $response$ $methodname$($request$ request, Metadata " "public virtual $response$ $methodname$($request$ request, Metadata "
"headers = null, DateTime? deadline = null, CancellationToken " "headers = null, DateTime? deadline = null, CancellationToken "
@ -411,7 +477,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); GenerateDocCommentClientMethod(out, method, true, true);
out->Print( out->Print(
"public virtual $response$ $methodname$($request$ request, " "public virtual $response$ $methodname$($request$ request, "
"CallOptions options)\n", "CallOptions options)\n",
@ -432,7 +498,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); GenerateDocCommentClientMethod(out, method, false, false);
out->Print( out->Print(
"public virtual $returntype$ $methodname$($request_maybe$Metadata " "public virtual $returntype$ $methodname$($request_maybe$Metadata "
"headers = null, DateTime? deadline = null, CancellationToken " "headers = null, DateTime? deadline = null, CancellationToken "
@ -452,7 +518,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); GenerateDocCommentClientMethod(out, method, false, true);
out->Print( out->Print(
"public virtual $returntype$ $methodname$($request_maybe$CallOptions " "public virtual $returntype$ $methodname$($request_maybe$CallOptions "
"options)\n", "options)\n",
@ -517,6 +583,9 @@ void GenerateBindServiceMethod(Printer *out, const ServiceDescriptor *service) {
out->Print( out->Print(
"/// <summary>Creates service definition that can be registered with a " "/// <summary>Creates service definition that can be registered with a "
"server</summary>\n"); "server</summary>\n");
out->Print(
"/// <param name=\"serviceImpl\">An object implementing the server-side"
" handling logic.</param>\n");
out->Print( out->Print(
"public static ServerServiceDefinition BindService($implclass$ " "public static ServerServiceDefinition BindService($implclass$ "
"serviceImpl)\n", "serviceImpl)\n",

@ -697,9 +697,15 @@ static void subchannel_ready(grpc_exec_ctx *exec_ctx, void *arg,
"Failed to create subchannel", &error, 1)); "Failed to create subchannel", &error, 1));
} else if (GET_CALL(calld) == CANCELLED_CALL) { } else if (GET_CALL(calld) == CANCELLED_CALL) {
/* already cancelled before subchannel became ready */ /* already cancelled before subchannel became ready */
fail_locked(exec_ctx, calld, grpc_error *cancellation_error = GRPC_ERROR_CREATE_REFERENCING(
GRPC_ERROR_CREATE_REFERENCING( "Cancelled before creating subchannel", &error, 1);
"Cancelled before creating subchannel", &error, 1)); /* if due to deadline, attach the deadline exceeded status to the error */
if (gpr_time_cmp(calld->deadline, gpr_now(GPR_CLOCK_MONOTONIC)) < 0) {
cancellation_error =
grpc_error_set_int(cancellation_error, GRPC_ERROR_INT_GRPC_STATUS,
GRPC_STATUS_DEADLINE_EXCEEDED);
}
fail_locked(exec_ctx, calld, cancellation_error);
} else { } else {
/* Create call on subchannel. */ /* Create call on subchannel. */
grpc_subchannel_call *subchannel_call = NULL; grpc_subchannel_call *subchannel_call = NULL;
@ -823,7 +829,6 @@ static bool pick_subchannel(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
initial_metadata_flags &= ~GRPC_INITIAL_METADATA_WAIT_FOR_READY; initial_metadata_flags &= ~GRPC_INITIAL_METADATA_WAIT_FOR_READY;
} }
} }
// TODO(dgq): make this deadline configurable somehow.
const grpc_lb_policy_pick_args inputs = { const grpc_lb_policy_pick_args inputs = {
initial_metadata, initial_metadata_flags, &calld->lb_token_mdelem, initial_metadata, initial_metadata_flags, &calld->lb_token_mdelem,
gpr_inf_future(GPR_CLOCK_MONOTONIC)}; gpr_inf_future(GPR_CLOCK_MONOTONIC)};

@ -85,39 +85,53 @@ namespace Math {
public abstract partial class MathBase public abstract partial class MathBase
{ {
/// <summary> /// <summary>
/// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient /// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient
/// and remainder. /// and remainder.
/// </summary> /// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Math.DivReply> Div(global::Math.DivArgs request, ServerCallContext context) public virtual global::System.Threading.Tasks.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> /// <summary>
/// DivMany accepts an arbitrary number of division args from the client stream /// 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 /// 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 /// the client closes its end; the server does the same after sending all the
/// replies. The stream ends immediately if either end aborts. /// replies. The stream ends immediately if either end aborts.
/// </summary> /// </summary>
/// <param name="requestStream">Used for reading requests from the client.</param>
/// <param name="responseStream">Used for sending responses back to the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>A task indicating completion of the handler.</returns>
public virtual global::System.Threading.Tasks.Task DivMany(IAsyncStreamReader<global::Math.DivArgs> requestStream, IServerStreamWriter<global::Math.DivReply> responseStream, ServerCallContext context) public virtual global::System.Threading.Tasks.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> /// <summary>
/// Fib generates numbers in the Fibonacci sequence. If FibArgs.limit > 0, Fib /// Fib generates numbers in the Fibonacci sequence. If FibArgs.limit > 0, Fib
/// generates up to limit numbers; otherwise it continues until the call is /// generates up to limit numbers; otherwise it continues until the call is
/// canceled. Unlike Fib above, Fib has no final FibReply. /// canceled. Unlike Fib above, Fib has no final FibReply.
/// </summary> /// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="responseStream">Used for sending responses back to the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>A task indicating completion of the handler.</returns>
public virtual global::System.Threading.Tasks.Task Fib(global::Math.FibArgs request, IServerStreamWriter<global::Math.Num> responseStream, ServerCallContext context) public virtual global::System.Threading.Tasks.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> /// <summary>
/// Sum sums a stream of numbers, returning the final result once the stream /// Sum sums a stream of numbers, returning the final result once the stream
/// is closed. /// is closed.
/// </summary> /// </summary>
/// <param name="requestStream">Used for reading requests from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Math.Num> Sum(IAsyncStreamReader<global::Math.Num> requestStream, ServerCallContext context) public virtual global::System.Threading.Tasks.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, ""));
@ -149,87 +163,123 @@ namespace Math {
} }
/// <summary> /// <summary>
/// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient /// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient
/// and remainder. /// and remainder.
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
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> /// <summary>
/// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient /// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient
/// and remainder. /// and remainder.
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
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> /// <summary>
/// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient /// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient
/// and remainder. /// and remainder.
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
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> /// <summary>
/// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient /// Div divides DivArgs.dividend by DivArgs.divisor and returns the quotient
/// and remainder. /// and remainder.
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
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> /// <summary>
/// DivMany accepts an arbitrary number of division args from the client stream /// 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 /// 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 /// the client closes its end; the server does the same after sending all the
/// replies. The stream ends immediately if either end aborts. /// replies. The stream ends immediately if either end aborts.
/// </summary> /// </summary>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
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> /// <summary>
/// DivMany accepts an arbitrary number of division args from the client stream /// 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 /// 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 /// the client closes its end; the server does the same after sending all the
/// replies. The stream ends immediately if either end aborts. /// replies. The stream ends immediately if either end aborts.
/// </summary> /// </summary>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
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> /// <summary>
/// Fib generates numbers in the Fibonacci sequence. If FibArgs.limit > 0, Fib /// Fib generates numbers in the Fibonacci sequence. If FibArgs.limit > 0, Fib
/// generates up to limit numbers; otherwise it continues until the call is /// generates up to limit numbers; otherwise it continues until the call is
/// canceled. Unlike Fib above, Fib has no final FibReply. /// canceled. Unlike Fib above, Fib has no final FibReply.
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
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> /// <summary>
/// Fib generates numbers in the Fibonacci sequence. If FibArgs.limit > 0, Fib /// Fib generates numbers in the Fibonacci sequence. If FibArgs.limit > 0, Fib
/// generates up to limit numbers; otherwise it continues until the call is /// generates up to limit numbers; otherwise it continues until the call is
/// canceled. Unlike Fib above, Fib has no final FibReply. /// canceled. Unlike Fib above, Fib has no final FibReply.
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
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> /// <summary>
/// Sum sums a stream of numbers, returning the final result once the stream /// Sum sums a stream of numbers, returning the final result once the stream
/// is closed. /// is closed.
/// </summary> /// </summary>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
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> /// <summary>
/// Sum sums a stream of numbers, returning the final result once the stream /// Sum sums a stream of numbers, returning the final result once the stream
/// is closed. /// is closed.
/// </summary> /// </summary>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
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);
@ -242,6 +292,7 @@ namespace Math {
} }
/// <summary>Creates service definition that can be registered with a server</summary> /// <summary>Creates service definition that can be registered with a server</summary>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
public static ServerServiceDefinition BindService(MathBase serviceImpl) public static ServerServiceDefinition BindService(MathBase serviceImpl)
{ {
return ServerServiceDefinition.CreateBuilder() return ServerServiceDefinition.CreateBuilder()

@ -115,6 +115,7 @@ namespace Grpc.Health.V1 {
} }
/// <summary>Creates service definition that can be registered with a server</summary> /// <summary>Creates service definition that can be registered with a server</summary>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
public static ServerServiceDefinition BindService(HealthBase serviceImpl) public static ServerServiceDefinition BindService(HealthBase serviceImpl)
{ {
return ServerServiceDefinition.CreateBuilder() return ServerServiceDefinition.CreateBuilder()

@ -76,17 +76,24 @@ namespace Grpc.Testing {
public abstract partial class MetricsServiceBase public abstract partial class MetricsServiceBase
{ {
/// <summary> /// <summary>
/// Returns the values of all the gauges that are currently being maintained by /// Returns the values of all the gauges that are currently being maintained by
/// the service /// the service
/// </summary> /// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="responseStream">Used for sending responses back to the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>A task indicating completion of the handler.</returns>
public virtual global::System.Threading.Tasks.Task GetAllGauges(global::Grpc.Testing.EmptyMessage request, IServerStreamWriter<global::Grpc.Testing.GaugeResponse> responseStream, ServerCallContext context) public virtual global::System.Threading.Tasks.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> /// <summary>
/// Returns the value of one gauge /// Returns the value of one gauge
/// </summary> /// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Grpc.Testing.GaugeResponse> GetGauge(global::Grpc.Testing.GaugeRequest request, ServerCallContext context) public virtual global::System.Threading.Tasks.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, ""));
@ -118,45 +125,69 @@ namespace Grpc.Testing {
} }
/// <summary> /// <summary>
/// Returns the values of all the gauges that are currently being maintained by /// Returns the values of all the gauges that are currently being maintained by
/// the service /// the service
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
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> /// <summary>
/// Returns the values of all the gauges that are currently being maintained by /// Returns the values of all the gauges that are currently being maintained by
/// the service /// the service
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
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> /// <summary>
/// Returns the value of one gauge /// Returns the value of one gauge
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
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> /// <summary>
/// Returns the value of one gauge /// Returns the value of one gauge
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
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> /// <summary>
/// Returns the value of one gauge /// Returns the value of one gauge
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
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> /// <summary>
/// Returns the value of one gauge /// Returns the value of one gauge
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
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);
@ -169,6 +200,7 @@ namespace Grpc.Testing {
} }
/// <summary>Creates service definition that can be registered with a server</summary> /// <summary>Creates service definition that can be registered with a server</summary>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
public static ServerServiceDefinition BindService(MetricsServiceBase serviceImpl) public static ServerServiceDefinition BindService(MetricsServiceBase serviceImpl)
{ {
return ServerServiceDefinition.CreateBuilder() return ServerServiceDefinition.CreateBuilder()

@ -71,18 +71,25 @@ namespace Grpc.Testing {
public abstract partial class BenchmarkServiceBase public abstract partial class BenchmarkServiceBase
{ {
/// <summary> /// <summary>
/// One request followed by one response. /// One request followed by one response.
/// The server returns the client payload as-is. /// The server returns the client payload as-is.
/// </summary> /// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Grpc.Testing.SimpleResponse> UnaryCall(global::Grpc.Testing.SimpleRequest request, ServerCallContext context) public virtual global::System.Threading.Tasks.Task<global::Grpc.Testing.SimpleResponse> UnaryCall(global::Grpc.Testing.SimpleRequest request, ServerCallContext context)
{ {
throw new RpcException(new Status(StatusCode.Unimplemented, "")); throw new RpcException(new Status(StatusCode.Unimplemented, ""));
} }
/// <summary> /// <summary>
/// One request followed by one response. /// One request followed by one response.
/// The server returns the client payload as-is. /// The server returns the client payload as-is.
/// </summary> /// </summary>
/// <param name="requestStream">Used for reading requests from the client.</param>
/// <param name="responseStream">Used for sending responses back to the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>A task indicating completion of the handler.</returns>
public virtual global::System.Threading.Tasks.Task StreamingCall(IAsyncStreamReader<global::Grpc.Testing.SimpleRequest> requestStream, IServerStreamWriter<global::Grpc.Testing.SimpleResponse> responseStream, ServerCallContext context) public virtual global::System.Threading.Tasks.Task StreamingCall(IAsyncStreamReader<global::Grpc.Testing.SimpleRequest> requestStream, IServerStreamWriter<global::Grpc.Testing.SimpleResponse> responseStream, ServerCallContext context)
{ {
throw new RpcException(new Status(StatusCode.Unimplemented, "")); throw new RpcException(new Status(StatusCode.Unimplemented, ""));
@ -114,49 +121,71 @@ namespace Grpc.Testing {
} }
/// <summary> /// <summary>
/// One request followed by one response. /// One request followed by one response.
/// The server returns the client payload as-is. /// The server returns the client payload as-is.
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return UnaryCall(request, new CallOptions(headers, deadline, cancellationToken)); return UnaryCall(request, new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary> /// <summary>
/// One request followed by one response. /// One request followed by one response.
/// The server returns the client payload as-is. /// The server returns the client payload as-is.
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, CallOptions options) public virtual global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, CallOptions options)
{ {
return CallInvoker.BlockingUnaryCall(__Method_UnaryCall, null, options, request); return CallInvoker.BlockingUnaryCall(__Method_UnaryCall, null, options, request);
} }
/// <summary> /// <summary>
/// One request followed by one response. /// One request followed by one response.
/// The server returns the client payload as-is. /// The server returns the client payload as-is.
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return UnaryCallAsync(request, new CallOptions(headers, deadline, cancellationToken)); return UnaryCallAsync(request, new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary> /// <summary>
/// One request followed by one response. /// One request followed by one response.
/// The server returns the client payload as-is. /// The server returns the client payload as-is.
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, CallOptions options) public virtual AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, CallOptions options)
{ {
return CallInvoker.AsyncUnaryCall(__Method_UnaryCall, null, options, request); return CallInvoker.AsyncUnaryCall(__Method_UnaryCall, null, options, request);
} }
/// <summary> /// <summary>
/// One request followed by one response. /// One request followed by one response.
/// The server returns the client payload as-is. /// The server returns the client payload as-is.
/// </summary> /// </summary>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.SimpleRequest, global::Grpc.Testing.SimpleResponse> StreamingCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.SimpleRequest, global::Grpc.Testing.SimpleResponse> StreamingCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return StreamingCall(new CallOptions(headers, deadline, cancellationToken)); return StreamingCall(new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary> /// <summary>
/// One request followed by one response. /// One request followed by one response.
/// The server returns the client payload as-is. /// The server returns the client payload as-is.
/// </summary> /// </summary>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.SimpleRequest, global::Grpc.Testing.SimpleResponse> StreamingCall(CallOptions options) public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.SimpleRequest, global::Grpc.Testing.SimpleResponse> StreamingCall(CallOptions options)
{ {
return CallInvoker.AsyncDuplexStreamingCall(__Method_StreamingCall, null, options); return CallInvoker.AsyncDuplexStreamingCall(__Method_StreamingCall, null, options);
@ -169,6 +198,7 @@ namespace Grpc.Testing {
} }
/// <summary>Creates service definition that can be registered with a server</summary> /// <summary>Creates service definition that can be registered with a server</summary>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
public static ServerServiceDefinition BindService(BenchmarkServiceBase serviceImpl) public static ServerServiceDefinition BindService(BenchmarkServiceBase serviceImpl)
{ {
return ServerServiceDefinition.CreateBuilder() return ServerServiceDefinition.CreateBuilder()
@ -227,42 +257,56 @@ namespace Grpc.Testing {
public abstract partial class WorkerServiceBase public abstract partial class WorkerServiceBase
{ {
/// <summary> /// <summary>
/// Start server with specified workload. /// Start server with specified workload.
/// First request sent specifies the ServerConfig followed by ServerStatus /// First request sent specifies the ServerConfig followed by ServerStatus
/// response. After that, a "Mark" can be sent anytime to request the latest /// response. After that, a "Mark" can be sent anytime to request the latest
/// stats. Closing the stream will initiate shutdown of the test server /// stats. Closing the stream will initiate shutdown of the test server
/// and once the shutdown has finished, the OK status is sent to terminate /// and once the shutdown has finished, the OK status is sent to terminate
/// this RPC. /// this RPC.
/// </summary> /// </summary>
/// <param name="requestStream">Used for reading requests from the client.</param>
/// <param name="responseStream">Used for sending responses back to the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>A task indicating completion of the handler.</returns>
public virtual global::System.Threading.Tasks.Task RunServer(IAsyncStreamReader<global::Grpc.Testing.ServerArgs> requestStream, IServerStreamWriter<global::Grpc.Testing.ServerStatus> responseStream, ServerCallContext context) public virtual global::System.Threading.Tasks.Task RunServer(IAsyncStreamReader<global::Grpc.Testing.ServerArgs> requestStream, IServerStreamWriter<global::Grpc.Testing.ServerStatus> responseStream, ServerCallContext context)
{ {
throw new RpcException(new Status(StatusCode.Unimplemented, "")); throw new RpcException(new Status(StatusCode.Unimplemented, ""));
} }
/// <summary> /// <summary>
/// Start client with specified workload. /// Start client with specified workload.
/// First request sent specifies the ClientConfig followed by ClientStatus /// First request sent specifies the ClientConfig followed by ClientStatus
/// response. After that, a "Mark" can be sent anytime to request the latest /// response. After that, a "Mark" can be sent anytime to request the latest
/// stats. Closing the stream will initiate shutdown of the test client /// stats. Closing the stream will initiate shutdown of the test client
/// and once the shutdown has finished, the OK status is sent to terminate /// and once the shutdown has finished, the OK status is sent to terminate
/// this RPC. /// this RPC.
/// </summary> /// </summary>
/// <param name="requestStream">Used for reading requests from the client.</param>
/// <param name="responseStream">Used for sending responses back to the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>A task indicating completion of the handler.</returns>
public virtual global::System.Threading.Tasks.Task RunClient(IAsyncStreamReader<global::Grpc.Testing.ClientArgs> requestStream, IServerStreamWriter<global::Grpc.Testing.ClientStatus> responseStream, ServerCallContext context) public virtual global::System.Threading.Tasks.Task RunClient(IAsyncStreamReader<global::Grpc.Testing.ClientArgs> requestStream, IServerStreamWriter<global::Grpc.Testing.ClientStatus> responseStream, ServerCallContext context)
{ {
throw new RpcException(new Status(StatusCode.Unimplemented, "")); throw new RpcException(new Status(StatusCode.Unimplemented, ""));
} }
/// <summary> /// <summary>
/// Just return the core count - unary call /// Just return the core count - unary call
/// </summary> /// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Grpc.Testing.CoreResponse> CoreCount(global::Grpc.Testing.CoreRequest request, ServerCallContext context) public virtual global::System.Threading.Tasks.Task<global::Grpc.Testing.CoreResponse> CoreCount(global::Grpc.Testing.CoreRequest request, ServerCallContext context)
{ {
throw new RpcException(new Status(StatusCode.Unimplemented, "")); throw new RpcException(new Status(StatusCode.Unimplemented, ""));
} }
/// <summary> /// <summary>
/// Quit this worker /// Quit this worker
/// </summary> /// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Grpc.Testing.Void> QuitWorker(global::Grpc.Testing.Void request, ServerCallContext context) public virtual global::System.Threading.Tasks.Task<global::Grpc.Testing.Void> QuitWorker(global::Grpc.Testing.Void request, ServerCallContext context)
{ {
throw new RpcException(new Status(StatusCode.Unimplemented, "")); throw new RpcException(new Status(StatusCode.Unimplemented, ""));
@ -294,105 +338,149 @@ namespace Grpc.Testing {
} }
/// <summary> /// <summary>
/// Start server with specified workload. /// Start server with specified workload.
/// First request sent specifies the ServerConfig followed by ServerStatus /// First request sent specifies the ServerConfig followed by ServerStatus
/// response. After that, a "Mark" can be sent anytime to request the latest /// response. After that, a "Mark" can be sent anytime to request the latest
/// stats. Closing the stream will initiate shutdown of the test server /// stats. Closing the stream will initiate shutdown of the test server
/// and once the shutdown has finished, the OK status is sent to terminate /// and once the shutdown has finished, the OK status is sent to terminate
/// this RPC. /// this RPC.
/// </summary> /// </summary>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus> RunServer(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus> RunServer(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return RunServer(new CallOptions(headers, deadline, cancellationToken)); return RunServer(new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary> /// <summary>
/// Start server with specified workload. /// Start server with specified workload.
/// First request sent specifies the ServerConfig followed by ServerStatus /// First request sent specifies the ServerConfig followed by ServerStatus
/// response. After that, a "Mark" can be sent anytime to request the latest /// response. After that, a "Mark" can be sent anytime to request the latest
/// stats. Closing the stream will initiate shutdown of the test server /// stats. Closing the stream will initiate shutdown of the test server
/// and once the shutdown has finished, the OK status is sent to terminate /// and once the shutdown has finished, the OK status is sent to terminate
/// this RPC. /// this RPC.
/// </summary> /// </summary>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus> RunServer(CallOptions options) public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus> RunServer(CallOptions options)
{ {
return CallInvoker.AsyncDuplexStreamingCall(__Method_RunServer, null, options); return CallInvoker.AsyncDuplexStreamingCall(__Method_RunServer, null, options);
} }
/// <summary> /// <summary>
/// Start client with specified workload. /// Start client with specified workload.
/// First request sent specifies the ClientConfig followed by ClientStatus /// First request sent specifies the ClientConfig followed by ClientStatus
/// response. After that, a "Mark" can be sent anytime to request the latest /// response. After that, a "Mark" can be sent anytime to request the latest
/// stats. Closing the stream will initiate shutdown of the test client /// stats. Closing the stream will initiate shutdown of the test client
/// and once the shutdown has finished, the OK status is sent to terminate /// and once the shutdown has finished, the OK status is sent to terminate
/// this RPC. /// this RPC.
/// </summary> /// </summary>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.ClientArgs, global::Grpc.Testing.ClientStatus> RunClient(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.ClientArgs, global::Grpc.Testing.ClientStatus> RunClient(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return RunClient(new CallOptions(headers, deadline, cancellationToken)); return RunClient(new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary> /// <summary>
/// Start client with specified workload. /// Start client with specified workload.
/// First request sent specifies the ClientConfig followed by ClientStatus /// First request sent specifies the ClientConfig followed by ClientStatus
/// response. After that, a "Mark" can be sent anytime to request the latest /// response. After that, a "Mark" can be sent anytime to request the latest
/// stats. Closing the stream will initiate shutdown of the test client /// stats. Closing the stream will initiate shutdown of the test client
/// and once the shutdown has finished, the OK status is sent to terminate /// and once the shutdown has finished, the OK status is sent to terminate
/// this RPC. /// this RPC.
/// </summary> /// </summary>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.ClientArgs, global::Grpc.Testing.ClientStatus> RunClient(CallOptions options) public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.ClientArgs, global::Grpc.Testing.ClientStatus> RunClient(CallOptions options)
{ {
return CallInvoker.AsyncDuplexStreamingCall(__Method_RunClient, null, options); return CallInvoker.AsyncDuplexStreamingCall(__Method_RunClient, null, options);
} }
/// <summary> /// <summary>
/// Just return the core count - unary call /// Just return the core count - unary call
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Grpc.Testing.CoreResponse CoreCount(global::Grpc.Testing.CoreRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual global::Grpc.Testing.CoreResponse CoreCount(global::Grpc.Testing.CoreRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return CoreCount(request, new CallOptions(headers, deadline, cancellationToken)); return CoreCount(request, new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary> /// <summary>
/// Just return the core count - unary call /// Just return the core count - unary call
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Grpc.Testing.CoreResponse CoreCount(global::Grpc.Testing.CoreRequest request, CallOptions options) public virtual global::Grpc.Testing.CoreResponse CoreCount(global::Grpc.Testing.CoreRequest request, CallOptions options)
{ {
return CallInvoker.BlockingUnaryCall(__Method_CoreCount, null, options, request); return CallInvoker.BlockingUnaryCall(__Method_CoreCount, null, options, request);
} }
/// <summary> /// <summary>
/// Just return the core count - unary call /// Just return the core count - unary call
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncUnaryCall<global::Grpc.Testing.CoreResponse> CoreCountAsync(global::Grpc.Testing.CoreRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual AsyncUnaryCall<global::Grpc.Testing.CoreResponse> CoreCountAsync(global::Grpc.Testing.CoreRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return CoreCountAsync(request, new CallOptions(headers, deadline, cancellationToken)); return CoreCountAsync(request, new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary> /// <summary>
/// Just return the core count - unary call /// Just return the core count - unary call
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncUnaryCall<global::Grpc.Testing.CoreResponse> CoreCountAsync(global::Grpc.Testing.CoreRequest request, CallOptions options) public virtual AsyncUnaryCall<global::Grpc.Testing.CoreResponse> CoreCountAsync(global::Grpc.Testing.CoreRequest request, CallOptions options)
{ {
return CallInvoker.AsyncUnaryCall(__Method_CoreCount, null, options, request); return CallInvoker.AsyncUnaryCall(__Method_CoreCount, null, options, request);
} }
/// <summary> /// <summary>
/// Quit this worker /// Quit this worker
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Grpc.Testing.Void QuitWorker(global::Grpc.Testing.Void request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual global::Grpc.Testing.Void QuitWorker(global::Grpc.Testing.Void request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return QuitWorker(request, new CallOptions(headers, deadline, cancellationToken)); return QuitWorker(request, new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary> /// <summary>
/// Quit this worker /// Quit this worker
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Grpc.Testing.Void QuitWorker(global::Grpc.Testing.Void request, CallOptions options) public virtual global::Grpc.Testing.Void QuitWorker(global::Grpc.Testing.Void request, CallOptions options)
{ {
return CallInvoker.BlockingUnaryCall(__Method_QuitWorker, null, options, request); return CallInvoker.BlockingUnaryCall(__Method_QuitWorker, null, options, request);
} }
/// <summary> /// <summary>
/// Quit this worker /// Quit this worker
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncUnaryCall<global::Grpc.Testing.Void> QuitWorkerAsync(global::Grpc.Testing.Void request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual AsyncUnaryCall<global::Grpc.Testing.Void> QuitWorkerAsync(global::Grpc.Testing.Void request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return QuitWorkerAsync(request, new CallOptions(headers, deadline, cancellationToken)); return QuitWorkerAsync(request, new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary> /// <summary>
/// Quit this worker /// Quit this worker
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncUnaryCall<global::Grpc.Testing.Void> QuitWorkerAsync(global::Grpc.Testing.Void request, CallOptions options) public virtual AsyncUnaryCall<global::Grpc.Testing.Void> QuitWorkerAsync(global::Grpc.Testing.Void request, CallOptions options)
{ {
return CallInvoker.AsyncUnaryCall(__Method_QuitWorker, null, options, request); return CallInvoker.AsyncUnaryCall(__Method_QuitWorker, null, options, request);
@ -405,6 +493,7 @@ namespace Grpc.Testing {
} }
/// <summary>Creates service definition that can be registered with a server</summary> /// <summary>Creates service definition that can be registered with a server</summary>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
public static ServerServiceDefinition BindService(WorkerServiceBase serviceImpl) public static ServerServiceDefinition BindService(WorkerServiceBase serviceImpl)
{ {
return ServerServiceDefinition.CreateBuilder() return ServerServiceDefinition.CreateBuilder()

@ -42,8 +42,8 @@ using Grpc.Core;
namespace Grpc.Testing { namespace Grpc.Testing {
/// <summary> /// <summary>
/// A simple service to test the various types of RPCs and experiment with /// A simple service to test the various types of RPCs and experiment with
/// performance with various types of payload. /// performance with various types of payload.
/// </summary> /// </summary>
public static partial class TestService public static partial class TestService
{ {
@ -123,74 +123,101 @@ namespace Grpc.Testing {
public abstract partial class TestServiceBase public abstract partial class TestServiceBase
{ {
/// <summary> /// <summary>
/// One empty request followed by one empty response. /// One empty request followed by one empty response.
/// </summary> /// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Grpc.Testing.Empty> EmptyCall(global::Grpc.Testing.Empty request, ServerCallContext context) public virtual global::System.Threading.Tasks.Task<global::Grpc.Testing.Empty> EmptyCall(global::Grpc.Testing.Empty request, ServerCallContext context)
{ {
throw new RpcException(new Status(StatusCode.Unimplemented, "")); throw new RpcException(new Status(StatusCode.Unimplemented, ""));
} }
/// <summary> /// <summary>
/// One request followed by one response. /// One request followed by one response.
/// </summary> /// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Grpc.Testing.SimpleResponse> UnaryCall(global::Grpc.Testing.SimpleRequest request, ServerCallContext context) public virtual global::System.Threading.Tasks.Task<global::Grpc.Testing.SimpleResponse> UnaryCall(global::Grpc.Testing.SimpleRequest request, ServerCallContext context)
{ {
throw new RpcException(new Status(StatusCode.Unimplemented, "")); throw new RpcException(new Status(StatusCode.Unimplemented, ""));
} }
/// <summary> /// <summary>
/// One request followed by one response. Response has cache control /// One request followed by one response. Response has cache control
/// headers set such that a caching HTTP proxy (such as GFE) can /// headers set such that a caching HTTP proxy (such as GFE) can
/// satisfy subsequent requests. /// satisfy subsequent requests.
/// </summary> /// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Grpc.Testing.SimpleResponse> CacheableUnaryCall(global::Grpc.Testing.SimpleRequest request, ServerCallContext context) public virtual global::System.Threading.Tasks.Task<global::Grpc.Testing.SimpleResponse> CacheableUnaryCall(global::Grpc.Testing.SimpleRequest request, ServerCallContext context)
{ {
throw new RpcException(new Status(StatusCode.Unimplemented, "")); throw new RpcException(new Status(StatusCode.Unimplemented, ""));
} }
/// <summary> /// <summary>
/// One request followed by a sequence of responses (streamed download). /// One request followed by a sequence of responses (streamed download).
/// The server returns the payload with client desired type and sizes. /// The server returns the payload with client desired type and sizes.
/// </summary> /// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="responseStream">Used for sending responses back to the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>A task indicating completion of the handler.</returns>
public virtual global::System.Threading.Tasks.Task StreamingOutputCall(global::Grpc.Testing.StreamingOutputCallRequest request, IServerStreamWriter<global::Grpc.Testing.StreamingOutputCallResponse> responseStream, ServerCallContext context) public virtual global::System.Threading.Tasks.Task StreamingOutputCall(global::Grpc.Testing.StreamingOutputCallRequest request, IServerStreamWriter<global::Grpc.Testing.StreamingOutputCallResponse> responseStream, ServerCallContext context)
{ {
throw new RpcException(new Status(StatusCode.Unimplemented, "")); throw new RpcException(new Status(StatusCode.Unimplemented, ""));
} }
/// <summary> /// <summary>
/// A sequence of requests followed by one response (streamed upload). /// A sequence of requests followed by one response (streamed upload).
/// The server returns the aggregated size of client payload as the result. /// The server returns the aggregated size of client payload as the result.
/// </summary> /// </summary>
/// <param name="requestStream">Used for reading requests from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Grpc.Testing.StreamingInputCallResponse> StreamingInputCall(IAsyncStreamReader<global::Grpc.Testing.StreamingInputCallRequest> requestStream, ServerCallContext context) public virtual global::System.Threading.Tasks.Task<global::Grpc.Testing.StreamingInputCallResponse> StreamingInputCall(IAsyncStreamReader<global::Grpc.Testing.StreamingInputCallRequest> requestStream, ServerCallContext context)
{ {
throw new RpcException(new Status(StatusCode.Unimplemented, "")); throw new RpcException(new Status(StatusCode.Unimplemented, ""));
} }
/// <summary> /// <summary>
/// A sequence of requests with each request served by the server immediately. /// A sequence of requests with each request served by the server immediately.
/// As one request could lead to multiple responses, this interface /// As one request could lead to multiple responses, this interface
/// demonstrates the idea of full duplexing. /// demonstrates the idea of full duplexing.
/// </summary> /// </summary>
/// <param name="requestStream">Used for reading requests from the client.</param>
/// <param name="responseStream">Used for sending responses back to the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>A task indicating completion of the handler.</returns>
public virtual global::System.Threading.Tasks.Task FullDuplexCall(IAsyncStreamReader<global::Grpc.Testing.StreamingOutputCallRequest> requestStream, IServerStreamWriter<global::Grpc.Testing.StreamingOutputCallResponse> responseStream, ServerCallContext context) public virtual global::System.Threading.Tasks.Task FullDuplexCall(IAsyncStreamReader<global::Grpc.Testing.StreamingOutputCallRequest> requestStream, IServerStreamWriter<global::Grpc.Testing.StreamingOutputCallResponse> responseStream, ServerCallContext context)
{ {
throw new RpcException(new Status(StatusCode.Unimplemented, "")); throw new RpcException(new Status(StatusCode.Unimplemented, ""));
} }
/// <summary> /// <summary>
/// A sequence of requests followed by a sequence of responses. /// A sequence of requests followed by a sequence of responses.
/// The server buffers all the client requests and then serves them in order. A /// The server buffers all the client requests and then serves them in order. A
/// stream of responses are returned to the client when the server starts with /// stream of responses are returned to the client when the server starts with
/// first request. /// first request.
/// </summary> /// </summary>
/// <param name="requestStream">Used for reading requests from the client.</param>
/// <param name="responseStream">Used for sending responses back to the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>A task indicating completion of the handler.</returns>
public virtual global::System.Threading.Tasks.Task HalfDuplexCall(IAsyncStreamReader<global::Grpc.Testing.StreamingOutputCallRequest> requestStream, IServerStreamWriter<global::Grpc.Testing.StreamingOutputCallResponse> responseStream, ServerCallContext context) public virtual global::System.Threading.Tasks.Task HalfDuplexCall(IAsyncStreamReader<global::Grpc.Testing.StreamingOutputCallRequest> requestStream, IServerStreamWriter<global::Grpc.Testing.StreamingOutputCallResponse> responseStream, ServerCallContext context)
{ {
throw new RpcException(new Status(StatusCode.Unimplemented, "")); throw new RpcException(new Status(StatusCode.Unimplemented, ""));
} }
/// <summary> /// <summary>
/// The test server will not implement this method. It will be used /// The test server will not implement this method. It will be used
/// to test the behavior when clients call unimplemented methods. /// to test the behavior when clients call unimplemented methods.
/// </summary> /// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Grpc.Testing.Empty> UnimplementedCall(global::Grpc.Testing.Empty request, ServerCallContext context) public virtual global::System.Threading.Tasks.Task<global::Grpc.Testing.Empty> UnimplementedCall(global::Grpc.Testing.Empty request, ServerCallContext context)
{ {
throw new RpcException(new Status(StatusCode.Unimplemented, "")); throw new RpcException(new Status(StatusCode.Unimplemented, ""));
@ -222,195 +249,285 @@ namespace Grpc.Testing {
} }
/// <summary> /// <summary>
/// One empty request followed by one empty response. /// One empty request followed by one empty response.
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Grpc.Testing.Empty EmptyCall(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual global::Grpc.Testing.Empty EmptyCall(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return EmptyCall(request, new CallOptions(headers, deadline, cancellationToken)); return EmptyCall(request, new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary> /// <summary>
/// One empty request followed by one empty response. /// One empty request followed by one empty response.
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Grpc.Testing.Empty EmptyCall(global::Grpc.Testing.Empty request, CallOptions options) public virtual global::Grpc.Testing.Empty EmptyCall(global::Grpc.Testing.Empty request, CallOptions options)
{ {
return CallInvoker.BlockingUnaryCall(__Method_EmptyCall, null, options, request); return CallInvoker.BlockingUnaryCall(__Method_EmptyCall, null, options, request);
} }
/// <summary> /// <summary>
/// One empty request followed by one empty response. /// One empty request followed by one empty response.
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncUnaryCall<global::Grpc.Testing.Empty> EmptyCallAsync(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual AsyncUnaryCall<global::Grpc.Testing.Empty> EmptyCallAsync(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return EmptyCallAsync(request, new CallOptions(headers, deadline, cancellationToken)); return EmptyCallAsync(request, new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary> /// <summary>
/// One empty request followed by one empty response. /// One empty request followed by one empty response.
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncUnaryCall<global::Grpc.Testing.Empty> EmptyCallAsync(global::Grpc.Testing.Empty request, CallOptions options) public virtual AsyncUnaryCall<global::Grpc.Testing.Empty> EmptyCallAsync(global::Grpc.Testing.Empty request, CallOptions options)
{ {
return CallInvoker.AsyncUnaryCall(__Method_EmptyCall, null, options, request); return CallInvoker.AsyncUnaryCall(__Method_EmptyCall, null, options, request);
} }
/// <summary> /// <summary>
/// One request followed by one response. /// One request followed by one response.
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return UnaryCall(request, new CallOptions(headers, deadline, cancellationToken)); return UnaryCall(request, new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary> /// <summary>
/// One request followed by one response. /// One request followed by one response.
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, CallOptions options) public virtual global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, CallOptions options)
{ {
return CallInvoker.BlockingUnaryCall(__Method_UnaryCall, null, options, request); return CallInvoker.BlockingUnaryCall(__Method_UnaryCall, null, options, request);
} }
/// <summary> /// <summary>
/// One request followed by one response. /// One request followed by one response.
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return UnaryCallAsync(request, new CallOptions(headers, deadline, cancellationToken)); return UnaryCallAsync(request, new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary> /// <summary>
/// One request followed by one response. /// One request followed by one response.
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, CallOptions options) public virtual AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, CallOptions options)
{ {
return CallInvoker.AsyncUnaryCall(__Method_UnaryCall, null, options, request); return CallInvoker.AsyncUnaryCall(__Method_UnaryCall, null, options, request);
} }
/// <summary> /// <summary>
/// One request followed by one response. Response has cache control /// One request followed by one response. Response has cache control
/// headers set such that a caching HTTP proxy (such as GFE) can /// headers set such that a caching HTTP proxy (such as GFE) can
/// satisfy subsequent requests. /// satisfy subsequent requests.
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Grpc.Testing.SimpleResponse CacheableUnaryCall(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual global::Grpc.Testing.SimpleResponse CacheableUnaryCall(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return CacheableUnaryCall(request, new CallOptions(headers, deadline, cancellationToken)); return CacheableUnaryCall(request, new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary> /// <summary>
/// One request followed by one response. Response has cache control /// One request followed by one response. Response has cache control
/// headers set such that a caching HTTP proxy (such as GFE) can /// headers set such that a caching HTTP proxy (such as GFE) can
/// satisfy subsequent requests. /// satisfy subsequent requests.
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Grpc.Testing.SimpleResponse CacheableUnaryCall(global::Grpc.Testing.SimpleRequest request, CallOptions options) public virtual global::Grpc.Testing.SimpleResponse CacheableUnaryCall(global::Grpc.Testing.SimpleRequest request, CallOptions options)
{ {
return CallInvoker.BlockingUnaryCall(__Method_CacheableUnaryCall, null, options, request); return CallInvoker.BlockingUnaryCall(__Method_CacheableUnaryCall, null, options, request);
} }
/// <summary> /// <summary>
/// One request followed by one response. Response has cache control /// One request followed by one response. Response has cache control
/// headers set such that a caching HTTP proxy (such as GFE) can /// headers set such that a caching HTTP proxy (such as GFE) can
/// satisfy subsequent requests. /// satisfy subsequent requests.
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> CacheableUnaryCallAsync(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> CacheableUnaryCallAsync(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return CacheableUnaryCallAsync(request, new CallOptions(headers, deadline, cancellationToken)); return CacheableUnaryCallAsync(request, new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary> /// <summary>
/// One request followed by one response. Response has cache control /// One request followed by one response. Response has cache control
/// headers set such that a caching HTTP proxy (such as GFE) can /// headers set such that a caching HTTP proxy (such as GFE) can
/// satisfy subsequent requests. /// satisfy subsequent requests.
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> CacheableUnaryCallAsync(global::Grpc.Testing.SimpleRequest request, CallOptions options) public virtual AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> CacheableUnaryCallAsync(global::Grpc.Testing.SimpleRequest request, CallOptions options)
{ {
return CallInvoker.AsyncUnaryCall(__Method_CacheableUnaryCall, null, options, request); return CallInvoker.AsyncUnaryCall(__Method_CacheableUnaryCall, null, options, request);
} }
/// <summary> /// <summary>
/// One request followed by a sequence of responses (streamed download). /// One request followed by a sequence of responses (streamed download).
/// The server returns the payload with client desired type and sizes. /// The server returns the payload with client desired type and sizes.
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncServerStreamingCall<global::Grpc.Testing.StreamingOutputCallResponse> StreamingOutputCall(global::Grpc.Testing.StreamingOutputCallRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual AsyncServerStreamingCall<global::Grpc.Testing.StreamingOutputCallResponse> StreamingOutputCall(global::Grpc.Testing.StreamingOutputCallRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return StreamingOutputCall(request, new CallOptions(headers, deadline, cancellationToken)); return StreamingOutputCall(request, new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary> /// <summary>
/// One request followed by a sequence of responses (streamed download). /// One request followed by a sequence of responses (streamed download).
/// The server returns the payload with client desired type and sizes. /// The server returns the payload with client desired type and sizes.
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncServerStreamingCall<global::Grpc.Testing.StreamingOutputCallResponse> StreamingOutputCall(global::Grpc.Testing.StreamingOutputCallRequest request, CallOptions options) public virtual AsyncServerStreamingCall<global::Grpc.Testing.StreamingOutputCallResponse> StreamingOutputCall(global::Grpc.Testing.StreamingOutputCallRequest request, CallOptions options)
{ {
return CallInvoker.AsyncServerStreamingCall(__Method_StreamingOutputCall, null, options, request); return CallInvoker.AsyncServerStreamingCall(__Method_StreamingOutputCall, null, options, request);
} }
/// <summary> /// <summary>
/// A sequence of requests followed by one response (streamed upload). /// A sequence of requests followed by one response (streamed upload).
/// The server returns the aggregated size of client payload as the result. /// The server returns the aggregated size of client payload as the result.
/// </summary> /// </summary>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncClientStreamingCall<global::Grpc.Testing.StreamingInputCallRequest, global::Grpc.Testing.StreamingInputCallResponse> StreamingInputCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual AsyncClientStreamingCall<global::Grpc.Testing.StreamingInputCallRequest, global::Grpc.Testing.StreamingInputCallResponse> StreamingInputCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return StreamingInputCall(new CallOptions(headers, deadline, cancellationToken)); return StreamingInputCall(new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary> /// <summary>
/// A sequence of requests followed by one response (streamed upload). /// A sequence of requests followed by one response (streamed upload).
/// The server returns the aggregated size of client payload as the result. /// The server returns the aggregated size of client payload as the result.
/// </summary> /// </summary>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncClientStreamingCall<global::Grpc.Testing.StreamingInputCallRequest, global::Grpc.Testing.StreamingInputCallResponse> StreamingInputCall(CallOptions options) public virtual AsyncClientStreamingCall<global::Grpc.Testing.StreamingInputCallRequest, global::Grpc.Testing.StreamingInputCallResponse> StreamingInputCall(CallOptions options)
{ {
return CallInvoker.AsyncClientStreamingCall(__Method_StreamingInputCall, null, options); return CallInvoker.AsyncClientStreamingCall(__Method_StreamingInputCall, null, options);
} }
/// <summary> /// <summary>
/// A sequence of requests with each request served by the server immediately. /// A sequence of requests with each request served by the server immediately.
/// As one request could lead to multiple responses, this interface /// As one request could lead to multiple responses, this interface
/// demonstrates the idea of full duplexing. /// demonstrates the idea of full duplexing.
/// </summary> /// </summary>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.StreamingOutputCallRequest, global::Grpc.Testing.StreamingOutputCallResponse> FullDuplexCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.StreamingOutputCallRequest, global::Grpc.Testing.StreamingOutputCallResponse> FullDuplexCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return FullDuplexCall(new CallOptions(headers, deadline, cancellationToken)); return FullDuplexCall(new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary> /// <summary>
/// A sequence of requests with each request served by the server immediately. /// A sequence of requests with each request served by the server immediately.
/// As one request could lead to multiple responses, this interface /// As one request could lead to multiple responses, this interface
/// demonstrates the idea of full duplexing. /// demonstrates the idea of full duplexing.
/// </summary> /// </summary>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.StreamingOutputCallRequest, global::Grpc.Testing.StreamingOutputCallResponse> FullDuplexCall(CallOptions options) public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.StreamingOutputCallRequest, global::Grpc.Testing.StreamingOutputCallResponse> FullDuplexCall(CallOptions options)
{ {
return CallInvoker.AsyncDuplexStreamingCall(__Method_FullDuplexCall, null, options); return CallInvoker.AsyncDuplexStreamingCall(__Method_FullDuplexCall, null, options);
} }
/// <summary> /// <summary>
/// A sequence of requests followed by a sequence of responses. /// A sequence of requests followed by a sequence of responses.
/// The server buffers all the client requests and then serves them in order. A /// The server buffers all the client requests and then serves them in order. A
/// stream of responses are returned to the client when the server starts with /// stream of responses are returned to the client when the server starts with
/// first request. /// first request.
/// </summary> /// </summary>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.StreamingOutputCallRequest, global::Grpc.Testing.StreamingOutputCallResponse> HalfDuplexCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.StreamingOutputCallRequest, global::Grpc.Testing.StreamingOutputCallResponse> HalfDuplexCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return HalfDuplexCall(new CallOptions(headers, deadline, cancellationToken)); return HalfDuplexCall(new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary> /// <summary>
/// A sequence of requests followed by a sequence of responses. /// A sequence of requests followed by a sequence of responses.
/// The server buffers all the client requests and then serves them in order. A /// The server buffers all the client requests and then serves them in order. A
/// stream of responses are returned to the client when the server starts with /// stream of responses are returned to the client when the server starts with
/// first request. /// first request.
/// </summary> /// </summary>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.StreamingOutputCallRequest, global::Grpc.Testing.StreamingOutputCallResponse> HalfDuplexCall(CallOptions options) public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.StreamingOutputCallRequest, global::Grpc.Testing.StreamingOutputCallResponse> HalfDuplexCall(CallOptions options)
{ {
return CallInvoker.AsyncDuplexStreamingCall(__Method_HalfDuplexCall, null, options); return CallInvoker.AsyncDuplexStreamingCall(__Method_HalfDuplexCall, null, options);
} }
/// <summary> /// <summary>
/// The test server will not implement this method. It will be used /// The test server will not implement this method. It will be used
/// to test the behavior when clients call unimplemented methods. /// to test the behavior when clients call unimplemented methods.
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Grpc.Testing.Empty UnimplementedCall(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual global::Grpc.Testing.Empty UnimplementedCall(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return UnimplementedCall(request, new CallOptions(headers, deadline, cancellationToken)); return UnimplementedCall(request, new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary> /// <summary>
/// The test server will not implement this method. It will be used /// The test server will not implement this method. It will be used
/// to test the behavior when clients call unimplemented methods. /// to test the behavior when clients call unimplemented methods.
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Grpc.Testing.Empty UnimplementedCall(global::Grpc.Testing.Empty request, CallOptions options) public virtual global::Grpc.Testing.Empty UnimplementedCall(global::Grpc.Testing.Empty request, CallOptions options)
{ {
return CallInvoker.BlockingUnaryCall(__Method_UnimplementedCall, null, options, request); return CallInvoker.BlockingUnaryCall(__Method_UnimplementedCall, null, options, request);
} }
/// <summary> /// <summary>
/// The test server will not implement this method. It will be used /// The test server will not implement this method. It will be used
/// to test the behavior when clients call unimplemented methods. /// to test the behavior when clients call unimplemented methods.
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncUnaryCall<global::Grpc.Testing.Empty> UnimplementedCallAsync(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual AsyncUnaryCall<global::Grpc.Testing.Empty> UnimplementedCallAsync(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return UnimplementedCallAsync(request, new CallOptions(headers, deadline, cancellationToken)); return UnimplementedCallAsync(request, new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary> /// <summary>
/// The test server will not implement this method. It will be used /// The test server will not implement this method. It will be used
/// to test the behavior when clients call unimplemented methods. /// to test the behavior when clients call unimplemented methods.
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncUnaryCall<global::Grpc.Testing.Empty> UnimplementedCallAsync(global::Grpc.Testing.Empty request, CallOptions options) public virtual AsyncUnaryCall<global::Grpc.Testing.Empty> UnimplementedCallAsync(global::Grpc.Testing.Empty request, CallOptions options)
{ {
return CallInvoker.AsyncUnaryCall(__Method_UnimplementedCall, null, options, request); return CallInvoker.AsyncUnaryCall(__Method_UnimplementedCall, null, options, request);
@ -423,6 +540,7 @@ namespace Grpc.Testing {
} }
/// <summary>Creates service definition that can be registered with a server</summary> /// <summary>Creates service definition that can be registered with a server</summary>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
public static ServerServiceDefinition BindService(TestServiceBase serviceImpl) public static ServerServiceDefinition BindService(TestServiceBase serviceImpl)
{ {
return ServerServiceDefinition.CreateBuilder() return ServerServiceDefinition.CreateBuilder()
@ -438,8 +556,8 @@ namespace Grpc.Testing {
} }
/// <summary> /// <summary>
/// A simple service NOT implemented at servers so clients can test for /// A simple service NOT implemented at servers so clients can test for
/// that case. /// that case.
/// </summary> /// </summary>
public static partial class UnimplementedService public static partial class UnimplementedService
{ {
@ -464,8 +582,11 @@ namespace Grpc.Testing {
public abstract partial class UnimplementedServiceBase public abstract partial class UnimplementedServiceBase
{ {
/// <summary> /// <summary>
/// A call that no server should implement /// A call that no server should implement
/// </summary> /// </summary>
/// <param name="request">The request received from the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>The response to send back to the client (wrapped by a task).</returns>
public virtual global::System.Threading.Tasks.Task<global::Grpc.Testing.Empty> UnimplementedCall(global::Grpc.Testing.Empty request, ServerCallContext context) public virtual global::System.Threading.Tasks.Task<global::Grpc.Testing.Empty> UnimplementedCall(global::Grpc.Testing.Empty request, ServerCallContext context)
{ {
throw new RpcException(new Status(StatusCode.Unimplemented, "")); throw new RpcException(new Status(StatusCode.Unimplemented, ""));
@ -497,29 +618,45 @@ namespace Grpc.Testing {
} }
/// <summary> /// <summary>
/// A call that no server should implement /// A call that no server should implement
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Grpc.Testing.Empty UnimplementedCall(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual global::Grpc.Testing.Empty UnimplementedCall(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return UnimplementedCall(request, new CallOptions(headers, deadline, cancellationToken)); return UnimplementedCall(request, new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary> /// <summary>
/// A call that no server should implement /// A call that no server should implement
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The response received from the server.</returns>
public virtual global::Grpc.Testing.Empty UnimplementedCall(global::Grpc.Testing.Empty request, CallOptions options) public virtual global::Grpc.Testing.Empty UnimplementedCall(global::Grpc.Testing.Empty request, CallOptions options)
{ {
return CallInvoker.BlockingUnaryCall(__Method_UnimplementedCall, null, options, request); return CallInvoker.BlockingUnaryCall(__Method_UnimplementedCall, null, options, request);
} }
/// <summary> /// <summary>
/// A call that no server should implement /// A call that no server should implement
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncUnaryCall<global::Grpc.Testing.Empty> UnimplementedCallAsync(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual AsyncUnaryCall<global::Grpc.Testing.Empty> UnimplementedCallAsync(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return UnimplementedCallAsync(request, new CallOptions(headers, deadline, cancellationToken)); return UnimplementedCallAsync(request, new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary> /// <summary>
/// A call that no server should implement /// A call that no server should implement
/// </summary> /// </summary>
/// <param name="request">The request to send to the server.</param>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncUnaryCall<global::Grpc.Testing.Empty> UnimplementedCallAsync(global::Grpc.Testing.Empty request, CallOptions options) public virtual AsyncUnaryCall<global::Grpc.Testing.Empty> UnimplementedCallAsync(global::Grpc.Testing.Empty request, CallOptions options)
{ {
return CallInvoker.AsyncUnaryCall(__Method_UnimplementedCall, null, options, request); return CallInvoker.AsyncUnaryCall(__Method_UnimplementedCall, null, options, request);
@ -532,6 +669,7 @@ namespace Grpc.Testing {
} }
/// <summary>Creates service definition that can be registered with a server</summary> /// <summary>Creates service definition that can be registered with a server</summary>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
public static ServerServiceDefinition BindService(UnimplementedServiceBase serviceImpl) public static ServerServiceDefinition BindService(UnimplementedServiceBase serviceImpl)
{ {
return ServerServiceDefinition.CreateBuilder() return ServerServiceDefinition.CreateBuilder()
@ -540,7 +678,7 @@ namespace Grpc.Testing {
} }
/// <summary> /// <summary>
/// A service used to control reconnect server. /// A service used to control reconnect server.
/// </summary> /// </summary>
public static partial class ReconnectService public static partial class ReconnectService
{ {
@ -648,6 +786,7 @@ namespace Grpc.Testing {
} }
/// <summary>Creates service definition that can be registered with a server</summary> /// <summary>Creates service definition that can be registered with a server</summary>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
public static ServerServiceDefinition BindService(ReconnectServiceBase serviceImpl) public static ServerServiceDefinition BindService(ReconnectServiceBase serviceImpl)
{ {
return ServerServiceDefinition.CreateBuilder() return ServerServiceDefinition.CreateBuilder()

@ -64,9 +64,13 @@ namespace Grpc.Reflection.V1Alpha {
public abstract partial class ServerReflectionBase public abstract partial class ServerReflectionBase
{ {
/// <summary> /// <summary>
/// The reflection service is structured as a bidirectional stream, ensuring /// The reflection service is structured as a bidirectional stream, ensuring
/// all related requests go to a single server. /// all related requests go to a single server.
/// </summary> /// </summary>
/// <param name="requestStream">Used for reading requests from the client.</param>
/// <param name="responseStream">Used for sending responses back to the client.</param>
/// <param name="context">The context of the server-side call handler being invoked.</param>
/// <returns>A task indicating completion of the handler.</returns>
public virtual global::System.Threading.Tasks.Task ServerReflectionInfo(IAsyncStreamReader<global::Grpc.Reflection.V1Alpha.ServerReflectionRequest> requestStream, IServerStreamWriter<global::Grpc.Reflection.V1Alpha.ServerReflectionResponse> responseStream, ServerCallContext context) public virtual global::System.Threading.Tasks.Task ServerReflectionInfo(IAsyncStreamReader<global::Grpc.Reflection.V1Alpha.ServerReflectionRequest> requestStream, IServerStreamWriter<global::Grpc.Reflection.V1Alpha.ServerReflectionResponse> responseStream, ServerCallContext context)
{ {
throw new RpcException(new Status(StatusCode.Unimplemented, "")); throw new RpcException(new Status(StatusCode.Unimplemented, ""));
@ -98,17 +102,23 @@ namespace Grpc.Reflection.V1Alpha {
} }
/// <summary> /// <summary>
/// The reflection service is structured as a bidirectional stream, ensuring /// The reflection service is structured as a bidirectional stream, ensuring
/// all related requests go to a single server. /// all related requests go to a single server.
/// </summary> /// </summary>
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param>
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param>
/// <param name="cancellationToken">An optional token for canceling the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncDuplexStreamingCall<global::Grpc.Reflection.V1Alpha.ServerReflectionRequest, global::Grpc.Reflection.V1Alpha.ServerReflectionResponse> ServerReflectionInfo(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) public virtual AsyncDuplexStreamingCall<global::Grpc.Reflection.V1Alpha.ServerReflectionRequest, global::Grpc.Reflection.V1Alpha.ServerReflectionResponse> ServerReflectionInfo(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{ {
return ServerReflectionInfo(new CallOptions(headers, deadline, cancellationToken)); return ServerReflectionInfo(new CallOptions(headers, deadline, cancellationToken));
} }
/// <summary> /// <summary>
/// The reflection service is structured as a bidirectional stream, ensuring /// The reflection service is structured as a bidirectional stream, ensuring
/// all related requests go to a single server. /// all related requests go to a single server.
/// </summary> /// </summary>
/// <param name="options">The options for the call.</param>
/// <returns>The call object.</returns>
public virtual AsyncDuplexStreamingCall<global::Grpc.Reflection.V1Alpha.ServerReflectionRequest, global::Grpc.Reflection.V1Alpha.ServerReflectionResponse> ServerReflectionInfo(CallOptions options) public virtual AsyncDuplexStreamingCall<global::Grpc.Reflection.V1Alpha.ServerReflectionRequest, global::Grpc.Reflection.V1Alpha.ServerReflectionResponse> ServerReflectionInfo(CallOptions options)
{ {
return CallInvoker.AsyncDuplexStreamingCall(__Method_ServerReflectionInfo, null, options); return CallInvoker.AsyncDuplexStreamingCall(__Method_ServerReflectionInfo, null, options);
@ -121,6 +131,7 @@ namespace Grpc.Reflection.V1Alpha {
} }
/// <summary>Creates service definition that can be registered with a server</summary> /// <summary>Creates service definition that can be registered with a server</summary>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
public static ServerServiceDefinition BindService(ServerReflectionBase serviceImpl) public static ServerServiceDefinition BindService(ServerReflectionBase serviceImpl)
{ {
return ServerServiceDefinition.CreateBuilder() return ServerServiceDefinition.CreateBuilder()

@ -31,6 +31,7 @@
import abc import abc
import enum import enum
import sys
import six import six
@ -924,21 +925,6 @@ class Server(six.with_metaclass(abc.ABCMeta)):
""" """
raise NotImplementedError() raise NotImplementedError()
@abc.abstractmethod
def add_shutdown_handler(self, shutdown_handler):
"""Adds a handler to be called on server shutdown.
Shutdown handlers are run on server stop() or in the event that a running
server is destroyed unexpectedly. The handlers are run in series before
the stop grace period.
Args:
shutdown_handler: A function taking a single arg, a time in seconds
within which the handler should complete. None indicates the handler can
run for any duration.
"""
raise NotImplementedError()
@abc.abstractmethod @abc.abstractmethod
def start(self): def start(self):
"""Starts this Server's service of RPCs. """Starts this Server's service of RPCs.
@ -949,7 +935,7 @@ class Server(six.with_metaclass(abc.ABCMeta)):
raise NotImplementedError() raise NotImplementedError()
@abc.abstractmethod @abc.abstractmethod
def stop(self, grace, shutdown_handler_grace=None): def stop(self, grace):
"""Stops this Server's service of RPCs. """Stops this Server's service of RPCs.
All calls to this method immediately stop service of new RPCs. When existing All calls to this method immediately stop service of new RPCs. When existing
@ -972,8 +958,6 @@ class Server(six.with_metaclass(abc.ABCMeta)):
aborted by this Server's stopping. If None, all RPCs will be aborted aborted by this Server's stopping. If None, all RPCs will be aborted
immediately and this method will block until this Server is completely immediately and this method will block until this Server is completely
stopped. stopped.
shutdown_handler_grace: A duration of time in seconds or None. This
value is passed to all shutdown handlers.
Returns: Returns:
A threading.Event that will be set when this Server has completely A threading.Event that will be set when this Server has completely
@ -1268,8 +1252,7 @@ def secure_channel(target, credentials, options=None):
credentials._credentials) credentials._credentials)
def server(thread_pool, handlers=None, options=None, exit_grace=None, def server(thread_pool, handlers=None, options=None):
exit_shutdown_handler_grace=None):
"""Creates a Server with which RPCs can be serviced. """Creates a Server with which RPCs can be serviced.
Args: Args:
@ -1282,19 +1265,13 @@ def server(thread_pool, handlers=None, options=None, exit_grace=None,
returned Server is started. returned Server is started.
options: A sequence of string-value pairs according to which to configure options: A sequence of string-value pairs according to which to configure
the created server. the created server.
exit_grace: The grace period to use when terminating
running servers at interpreter exit. None indicates unspecified.
exit_shutdown_handler_grace: The shutdown handler grace to use when
terminating running servers at interpreter exit. None indicates
unspecified.
Returns: Returns:
A Server with which RPCs can be serviced. A Server with which RPCs can be serviced.
""" """
from grpc import _server from grpc import _server
return _server.Server(thread_pool, () if handlers is None else handlers, return _server.Server(thread_pool, () if handlers is None else handlers,
() if options is None else options, exit_grace, () if options is None else options)
exit_shutdown_handler_grace)
################################### __all__ ################################# ################################### __all__ #################################
@ -1342,3 +1319,24 @@ __all__ = (
'secure_channel', 'secure_channel',
'server', 'server',
) )
############################### Extension Shims ################################
# Here to maintain backwards compatibility; avoid using these in new code!
try:
import grpc_tools
sys.modules.update({'grpc.tools': grpc_tools})
except ImportError:
pass
try:
import grpc_health
sys.modules.update({'grpc.health': grpc_health})
except ImportError:
pass
try:
import grpc_reflection
sys.modules.update({'grpc.reflection': grpc_reflection})
except ImportError:
pass

@ -60,8 +60,7 @@ _CANCELLED = 'cancelled'
_EMPTY_FLAGS = 0 _EMPTY_FLAGS = 0
_EMPTY_METADATA = cygrpc.Metadata(()) _EMPTY_METADATA = cygrpc.Metadata(())
_DEFAULT_EXIT_GRACE = 1.0 _UNEXPECTED_EXIT_SERVER_GRACE = 1.0
_DEFAULT_EXIT_SHUTDOWN_HANDLER_GRACE = 5.0
def _serialized_request(request_event): def _serialized_request(request_event):
@ -596,18 +595,14 @@ class _ServerStage(enum.Enum):
class _ServerState(object): class _ServerState(object):
def __init__(self, completion_queue, server, generic_handlers, thread_pool, def __init__(self, completion_queue, server, generic_handlers, thread_pool):
exit_grace, exit_shutdown_handler_grace):
self.lock = threading.Lock() self.lock = threading.Lock()
self.completion_queue = completion_queue self.completion_queue = completion_queue
self.server = server self.server = server
self.generic_handlers = list(generic_handlers) self.generic_handlers = list(generic_handlers)
self.thread_pool = thread_pool self.thread_pool = thread_pool
self.exit_grace = exit_grace
self.exit_shutdown_handler_grace = exit_shutdown_handler_grace
self.stage = _ServerStage.STOPPED self.stage = _ServerStage.STOPPED
self.shutdown_events = None self.shutdown_events = None
self.shutdown_handlers = []
# TODO(https://github.com/grpc/grpc/issues/6597): eliminate these fields. # TODO(https://github.com/grpc/grpc/issues/6597): eliminate these fields.
self.rpc_states = set() self.rpc_states = set()
@ -677,45 +672,41 @@ def _serve(state):
return return
def _stop(state, grace, shutdown_handler_grace): def _stop(state, grace):
shutdown_event = threading.Event() with state.lock:
if state.stage is _ServerStage.STOPPED:
def cancel_all_calls_after_grace(): shutdown_event = threading.Event()
with state.lock: shutdown_event.set()
if state.stage is _ServerStage.STOPPED: return shutdown_event
shutdown_event.set() else:
return if state.stage is _ServerStage.STARTED:
elif state.stage is _ServerStage.STARTED:
do_shutdown = True
state.stage = _ServerStage.GRACE
state.shutdown_events = []
else:
do_shutdown = False
state.shutdown_events.append(shutdown_event)
if do_shutdown:
# Run Shutdown Handlers without the lock
for handler in state.shutdown_handlers:
handler(shutdown_handler_grace)
with state.lock:
state.server.shutdown(state.completion_queue, _SHUTDOWN_TAG) state.server.shutdown(state.completion_queue, _SHUTDOWN_TAG)
state.stage = _ServerStage.GRACE state.stage = _ServerStage.GRACE
state.shutdown_events = []
state.due.add(_SHUTDOWN_TAG) state.due.add(_SHUTDOWN_TAG)
shutdown_event = threading.Event()
if not shutdown_event.wait(timeout=grace): state.shutdown_events.append(shutdown_event)
with state.lock: if grace is None:
state.server.cancel_all_calls() state.server.cancel_all_calls()
# TODO(https://github.com/grpc/grpc/issues/6597): delete this loop. # TODO(https://github.com/grpc/grpc/issues/6597): delete this loop.
for rpc_state in state.rpc_states: for rpc_state in state.rpc_states:
with rpc_state.condition: with rpc_state.condition:
rpc_state.client = _CANCELLED rpc_state.client = _CANCELLED
rpc_state.condition.notify_all() rpc_state.condition.notify_all()
else:
if grace is None: def cancel_all_calls_after_grace():
cancel_all_calls_after_grace() shutdown_event.wait(timeout=grace)
else: with state.lock:
threading.Thread(target=cancel_all_calls_after_grace).start() state.server.cancel_all_calls()
# TODO(https://github.com/grpc/grpc/issues/6597): delete this loop.
for rpc_state in state.rpc_states:
with rpc_state.condition:
rpc_state.client = _CANCELLED
rpc_state.condition.notify_all()
thread = threading.Thread(target=cancel_all_calls_after_grace)
thread.start()
return shutdown_event
shutdown_event.wait()
return shutdown_event return shutdown_event
@ -725,12 +716,12 @@ def _start(state):
raise ValueError('Cannot start already-started server!') raise ValueError('Cannot start already-started server!')
state.server.start() state.server.start()
state.stage = _ServerStage.STARTED state.stage = _ServerStage.STARTED
_request_call(state) _request_call(state)
def cleanup_server(timeout): def cleanup_server(timeout):
if timeout is None: if timeout is None:
_stop(state, state.exit_grace, state.exit_shutdown_handler_grace).wait() _stop(state, _UNEXPECTED_EXIT_SERVER_GRACE).wait()
else: else:
_stop(state, timeout, 0).wait() _stop(state, timeout).wait()
thread = _common.CleanupThread( thread = _common.CleanupThread(
cleanup_server, target=_serve, args=(state,)) cleanup_server, target=_serve, args=(state,))
@ -738,16 +729,12 @@ def _start(state):
class Server(grpc.Server): class Server(grpc.Server):
def __init__(self, thread_pool, generic_handlers, options, exit_grace, def __init__(self, thread_pool, generic_handlers, options):
exit_shutdown_handler_grace):
completion_queue = cygrpc.CompletionQueue() completion_queue = cygrpc.CompletionQueue()
server = cygrpc.Server(_common.channel_args(options)) server = cygrpc.Server(_common.channel_args(options))
server.register_completion_queue(completion_queue) server.register_completion_queue(completion_queue)
self._state = _ServerState( self._state = _ServerState(
completion_queue, server, generic_handlers, thread_pool, completion_queue, server, generic_handlers, thread_pool)
_DEFAULT_EXIT_GRACE if exit_grace is None else exit_grace,
_DEFAULT_EXIT_SHUTDOWN_HANDLER_GRACE if exit_shutdown_handler_grace
is None else exit_shutdown_handler_grace)
def add_generic_rpc_handlers(self, generic_rpc_handlers): def add_generic_rpc_handlers(self, generic_rpc_handlers):
_add_generic_handlers(self._state, generic_rpc_handlers) _add_generic_handlers(self._state, generic_rpc_handlers)
@ -758,14 +745,11 @@ class Server(grpc.Server):
def add_secure_port(self, address, server_credentials): def add_secure_port(self, address, server_credentials):
return _add_secure_port(self._state, _common.encode(address), server_credentials) return _add_secure_port(self._state, _common.encode(address), server_credentials)
def add_shutdown_handler(self, handler):
self._state.shutdown_handlers.append(handler)
def start(self): def start(self):
_start(self._state) _start(self._state)
def stop(self, grace, shutdown_handler_grace=None): def stop(self, grace):
return _stop(self._state, grace, shutdown_handler_grace) return _stop(self._state, grace)
def __del__(self): def __del__(self):
_stop(self._state, None, None) _stop(self._state, None)

@ -1,30 +0,0 @@
# 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.
__import__('pkg_resources').declare_namespace(__name__)

@ -33,7 +33,7 @@ import threading
import grpc import grpc
from grpc.health.v1 import health_pb2 from grpc_health.v1 import health_pb2
class HealthServicer(health_pb2.HealthServicer): class HealthServicer(health_pb2.HealthServicer):

@ -54,7 +54,7 @@ class CopyProtoModules(setuptools.Command):
if os.path.isfile(HEALTH_PROTO): if os.path.isfile(HEALTH_PROTO):
shutil.copyfile( shutil.copyfile(
HEALTH_PROTO, HEALTH_PROTO,
os.path.join(ROOT_DIR, 'grpc/health/v1/health.proto')) os.path.join(ROOT_DIR, 'grpc_health/v1/health.proto'))
class BuildPackageProtos(setuptools.Command): class BuildPackageProtos(setuptools.Command):
@ -74,5 +74,5 @@ class BuildPackageProtos(setuptools.Command):
# directory is provided as an 'include' directory. We assume it's the '' key # directory is provided as an 'include' directory. We assume it's the '' key
# to `self.distribution.package_dir` (and get a key error if it's not # to `self.distribution.package_dir` (and get a key error if it's not
# there). # there).
from grpc.tools import command from grpc_tools import command
command.build_package_protos(self.distribution.package_dir['']) command.build_package_protos(self.distribution.package_dir[''])

@ -66,7 +66,6 @@ setuptools.setup(
license='3-clause BSD', license='3-clause BSD',
package_dir=PACKAGE_DIRECTORIES, package_dir=PACKAGE_DIRECTORIES,
packages=setuptools.find_packages('.'), packages=setuptools.find_packages('.'),
namespace_packages=['grpc'],
install_requires=INSTALL_REQUIRES, install_requires=INSTALL_REQUIRES,
setup_requires=SETUP_REQUIRES, setup_requires=SETUP_REQUIRES,
cmdclass=COMMAND_CLASS cmdclass=COMMAND_CLASS

@ -1,30 +0,0 @@
# Copyright 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.
__import__('pkg_resources').declare_namespace(__name__)

@ -35,7 +35,7 @@ import grpc
from google.protobuf import descriptor_pb2 from google.protobuf import descriptor_pb2
from google.protobuf import descriptor_pool from google.protobuf import descriptor_pool
from grpc.reflection.v1alpha import reflection_pb2 from grpc_reflection.v1alpha import reflection_pb2
_POOL = descriptor_pool.Default() _POOL = descriptor_pool.Default()

@ -54,7 +54,7 @@ class CopyProtoModules(setuptools.Command):
if os.path.isfile(HEALTH_PROTO): if os.path.isfile(HEALTH_PROTO):
shutil.copyfile( shutil.copyfile(
HEALTH_PROTO, HEALTH_PROTO,
os.path.join(ROOT_DIR, 'grpc/reflection/v1alpha/reflection.proto')) os.path.join(ROOT_DIR, 'grpc_reflection/v1alpha/reflection.proto'))
class BuildPackageProtos(setuptools.Command): class BuildPackageProtos(setuptools.Command):
@ -74,5 +74,5 @@ class BuildPackageProtos(setuptools.Command):
# directory is provided as an 'include' directory. We assume it's the '' key # directory is provided as an 'include' directory. We assume it's the '' key
# to `self.distribution.package_dir` (and get a key error if it's not # to `self.distribution.package_dir` (and get a key error if it's not
# there). # there).
from grpc.tools import command from grpc_tools import command
command.build_package_protos(self.distribution.package_dir['']) command.build_package_protos(self.distribution.package_dir[''])

@ -66,7 +66,6 @@ setuptools.setup(
license='3-clause BSD', license='3-clause BSD',
package_dir=PACKAGE_DIRECTORIES, package_dir=PACKAGE_DIRECTORIES,
packages=setuptools.find_packages('.'), packages=setuptools.find_packages('.'),
namespace_packages=['grpc'],
install_requires=INSTALL_REQUIRES, install_requires=INSTALL_REQUIRES,
setup_requires=SETUP_REQUIRES, setup_requires=SETUP_REQUIRES,
cmdclass=COMMAND_CLASS cmdclass=COMMAND_CLASS

@ -100,7 +100,7 @@ class BuildProtoModules(setuptools.Command):
pass pass
def run(self): def run(self):
import grpc.tools.protoc as protoc import grpc_tools.protoc as protoc
include_regex = re.compile(self.include) include_regex = re.compile(self.include)
exclude_regex = re.compile(self.exclude) if self.exclude else None exclude_regex = re.compile(self.exclude) if self.exclude else None
@ -116,7 +116,7 @@ class BuildProtoModules(setuptools.Command):
# but we currently have name conflicts in src/proto # but we currently have name conflicts in src/proto
for path in paths: for path in paths:
command = [ command = [
'grpc.tools.protoc', 'grpc_tools.protoc',
'-I {}'.format(PROTO_STEM), '-I {}'.format(PROTO_STEM),
'--python_out={}'.format(PROTO_STEM), '--python_out={}'.format(PROTO_STEM),
'--grpc_python_out={}'.format(PROTO_STEM), '--grpc_python_out={}'.format(PROTO_STEM),

@ -35,7 +35,7 @@ import sys
import setuptools import setuptools
import grpc.tools.command import grpc_tools.command
PY3 = sys.version_info.major == 3 PY3 = sys.version_info.major == 3
@ -68,7 +68,7 @@ COMMAND_CLASS = {
# Run `preprocess` *before* doing any packaging! # Run `preprocess` *before* doing any packaging!
'preprocess': commands.GatherProto, 'preprocess': commands.GatherProto,
'build_package_protos': grpc.tools.command.BuildPackageProtos, 'build_package_protos': grpc_tools.command.BuildPackageProtos,
'build_py': commands.BuildPy, 'build_py': commands.BuildPy,
'run_interop': commands.RunInterop, 'run_interop': commands.RunInterop,
'test_lite': commands.TestLite 'test_lite': commands.TestLite

@ -27,14 +27,14 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""Tests of grpc.health.v1.health.""" """Tests of grpc_health.v1.health."""
import unittest import unittest
import grpc import grpc
from grpc.framework.foundation import logging_pool from grpc.framework.foundation import logging_pool
from grpc.health.v1 import health from grpc_health.v1 import health
from grpc.health.v1 import health_pb2 from grpc_health.v1 import health_pb2
from tests.unit.framework.common import test_constants from tests.unit.framework.common import test_constants

@ -44,7 +44,7 @@ import threading
import unittest import unittest
import grpc import grpc
from grpc.tools import protoc from grpc_tools import protoc
from tests.unit.framework.common import test_constants from tests.unit.framework.common import test_constants
_MESSAGES_IMPORT = b'import "messages.proto";' _MESSAGES_IMPORT = b'import "messages.proto";'

@ -27,14 +27,14 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""Tests of grpc.reflection.v1alpha.reflection.""" """Tests of grpc_reflection.v1alpha.reflection."""
import unittest import unittest
import grpc import grpc
from grpc.framework.foundation import logging_pool from grpc.framework.foundation import logging_pool
from grpc.reflection.v1alpha import reflection from grpc_reflection.v1alpha import reflection
from grpc.reflection.v1alpha import reflection_pb2 from grpc_reflection.v1alpha import reflection_pb2
from google.protobuf import descriptor_pool from google.protobuf import descriptor_pool
from google.protobuf import descriptor_pb2 from google.protobuf import descriptor_pb2

@ -27,7 +27,6 @@
"unit._cython.cygrpc_test.TypeSmokeTest", "unit._cython.cygrpc_test.TypeSmokeTest",
"unit._empty_message_test.EmptyMessageTest", "unit._empty_message_test.EmptyMessageTest",
"unit._exit_test.ExitTest", "unit._exit_test.ExitTest",
"unit._exit_test.ShutdownHandlerTest",
"unit._metadata_code_details_test.MetadataCodeDetailsTest", "unit._metadata_code_details_test.MetadataCodeDetailsTest",
"unit._metadata_test.MetadataTest", "unit._metadata_test.MetadataTest",
"unit._rpc_test.RPCTest", "unit._rpc_test.RPCTest",

@ -43,8 +43,6 @@ import threading
import time import time
import unittest import unittest
import grpc
from grpc.framework.foundation import logging_pool
from tests.unit import _exit_scenarios from tests.unit import _exit_scenarios
SCENARIO_FILE = os.path.abspath(os.path.join( SCENARIO_FILE = os.path.abspath(os.path.join(
@ -54,7 +52,7 @@ BASE_COMMAND = [INTERPRETER, SCENARIO_FILE]
BASE_SIGTERM_COMMAND = BASE_COMMAND + ['--wait_for_interrupt'] BASE_SIGTERM_COMMAND = BASE_COMMAND + ['--wait_for_interrupt']
INIT_TIME = 1.0 INIT_TIME = 1.0
SHUTDOWN_GRACE = 5.0
processes = [] processes = []
process_lock = threading.Lock() process_lock = threading.Lock()
@ -184,24 +182,5 @@ class ExitTest(unittest.TestCase):
interrupt_and_wait(process) interrupt_and_wait(process)
class _ShutDownHandler(object):
def __init__(self):
self.seen_handler_grace = None
def shutdown_handler(self, handler_grace):
self.seen_handler_grace = handler_grace
class ShutdownHandlerTest(unittest.TestCase):
def test_shutdown_handler(self):
server = grpc.server(logging_pool.pool(1))
handler = _ShutDownHandler()
server.add_shutdown_handler(handler.shutdown_handler)
server.start()
server.stop(0, shutdown_handler_grace=SHUTDOWN_GRACE).wait()
self.assertEqual(SHUTDOWN_GRACE, handler.seen_handler_grace)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main(verbosity=2) unittest.main(verbosity=2)

@ -1,30 +0,0 @@
# Copyright 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.
__import__('pkg_resources').declare_namespace(__name__)

@ -29,7 +29,7 @@
from libc cimport stdlib from libc cimport stdlib
cdef extern from "grpc/tools/main.h": cdef extern from "grpc_tools/main.h":
int protoc_main(int argc, char *argv[]) int protoc_main(int argc, char *argv[])
def run_main(list args not None): def run_main(list args not None):

@ -33,7 +33,7 @@ import sys
import setuptools import setuptools
from grpc.tools import protoc from grpc_tools import protoc
def build_package_protos(package_root): def build_package_protos(package_root):
@ -45,7 +45,7 @@ def build_package_protos(package_root):
proto_files.append(os.path.abspath(os.path.join(root, filename))) proto_files.append(os.path.abspath(os.path.join(root, filename)))
well_known_protos_include = pkg_resources.resource_filename( well_known_protos_include = pkg_resources.resource_filename(
'grpc.tools', '_proto') 'grpc_tools', '_proto')
for proto_file in proto_files: for proto_file in proto_files:
command = [ command = [

@ -32,7 +32,7 @@
#include "src/compiler/python_generator.h" #include "src/compiler/python_generator.h"
#include "grpc/tools/main.h" #include "grpc_tools/main.h"
int protoc_main(int argc, char* argv[]) { int protoc_main(int argc, char* argv[]) {
google::protobuf::compiler::CommandLineInterface cli; google::protobuf::compiler::CommandLineInterface cli;

@ -32,7 +32,7 @@
import pkg_resources import pkg_resources
import sys import sys
from grpc.tools import _protoc_compiler from grpc_tools import _protoc_compiler
def main(command_arguments): def main(command_arguments):
"""Run the protocol buffer compiler with the given command-line arguments. """Run the protocol buffer compiler with the given command-line arguments.

@ -108,7 +108,7 @@ PROTO_FILES = [
CC_INCLUDE = os.path.normpath(protoc_lib_deps.CC_INCLUDE) CC_INCLUDE = os.path.normpath(protoc_lib_deps.CC_INCLUDE)
PROTO_INCLUDE = os.path.normpath(protoc_lib_deps.PROTO_INCLUDE) PROTO_INCLUDE = os.path.normpath(protoc_lib_deps.PROTO_INCLUDE)
GRPC_PYTHON_TOOLS_PACKAGE = 'grpc.tools' GRPC_PYTHON_TOOLS_PACKAGE = 'grpc_tools'
GRPC_PYTHON_PROTO_RESOURCES_NAME = '_proto' GRPC_PYTHON_PROTO_RESOURCES_NAME = '_proto'
DEFINE_MACROS = () DEFINE_MACROS = ()
@ -154,16 +154,16 @@ def package_data():
def extension_modules(): def extension_modules():
if BUILD_WITH_CYTHON: if BUILD_WITH_CYTHON:
plugin_sources = [os.path.join('grpc', 'tools', '_protoc_compiler.pyx')] plugin_sources = [os.path.join('grpc_tools', '_protoc_compiler.pyx')]
else: else:
plugin_sources = [os.path.join('grpc', 'tools', '_protoc_compiler.cpp')] plugin_sources = [os.path.join('grpc_tools', '_protoc_compiler.cpp')]
plugin_sources += [ plugin_sources += [
os.path.join('grpc', 'tools', 'main.cc'), os.path.join('grpc_tools', 'main.cc'),
os.path.join('grpc_root', 'src', 'compiler', 'python_generator.cc')] + [ os.path.join('grpc_root', 'src', 'compiler', 'python_generator.cc')] + [
os.path.join(CC_INCLUDE, cc_file) os.path.join(CC_INCLUDE, cc_file)
for cc_file in CC_FILES] for cc_file in CC_FILES]
plugin_ext = extension.Extension( plugin_ext = extension.Extension(
name='grpc.tools._protoc_compiler', name='grpc_tools._protoc_compiler',
sources=plugin_sources, sources=plugin_sources,
include_dirs=[ include_dirs=[
'.', '.',
@ -189,7 +189,6 @@ setuptools.setup(
license='3-clause BSD', license='3-clause BSD',
ext_modules=extension_modules(), ext_modules=extension_modules(),
packages=setuptools.find_packages('.'), packages=setuptools.find_packages('.'),
namespace_packages=['grpc'],
install_requires=[ install_requires=[
'protobuf>=3.0.0', 'protobuf>=3.0.0',
'grpcio>={version}'.format(version=grpc_version.VERSION), 'grpcio>={version}'.format(version=grpc_version.VERSION),

Loading…
Cancel
Save