From 781720f82d2cb97f1447653c55d9504c46f86742 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 3 Jun 2016 17:40:28 -0700 Subject: [PATCH 1/3] get rid of servicename argument for server service definition. --- src/csharp/Grpc.Core.Tests/MockServiceHelper.cs | 2 +- src/csharp/Grpc.Core.Tests/ServerTest.cs | 2 +- src/csharp/Grpc.Core/AsyncClientStreamingCall.cs | 4 ++++ src/csharp/Grpc.Core/ServerServiceDefinition.cs | 10 +++------- src/csharp/Grpc.IntegrationTesting/GenericService.cs | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/csharp/Grpc.Core.Tests/MockServiceHelper.cs b/src/csharp/Grpc.Core.Tests/MockServiceHelper.cs index 30473143452..4d904700569 100644 --- a/src/csharp/Grpc.Core.Tests/MockServiceHelper.cs +++ b/src/csharp/Grpc.Core.Tests/MockServiceHelper.cs @@ -102,7 +102,7 @@ namespace Grpc.Core.Tests marshaller, marshaller); - serviceDefinition = ServerServiceDefinition.CreateBuilder(ServiceName) + serviceDefinition = ServerServiceDefinition.CreateBuilder() .AddMethod(unaryMethod, (request, context) => unaryHandler(request, context)) .AddMethod(clientStreamingMethod, (requestStream, context) => clientStreamingHandler(requestStream, context)) .AddMethod(serverStreamingMethod, (request, responseStream, context) => serverStreamingHandler(request, responseStream, context)) diff --git a/src/csharp/Grpc.Core.Tests/ServerTest.cs b/src/csharp/Grpc.Core.Tests/ServerTest.cs index b40508accc7..fa693162ada 100644 --- a/src/csharp/Grpc.Core.Tests/ServerTest.cs +++ b/src/csharp/Grpc.Core.Tests/ServerTest.cs @@ -89,7 +89,7 @@ namespace Grpc.Core.Tests }; server.Start(); Assert.Throws(typeof(InvalidOperationException), () => server.Ports.Add("localhost", 9999, ServerCredentials.Insecure)); - Assert.Throws(typeof(InvalidOperationException), () => server.Services.Add(ServerServiceDefinition.CreateBuilder("serviceName").Build())); + Assert.Throws(typeof(InvalidOperationException), () => server.Services.Add(ServerServiceDefinition.CreateBuilder().Build())); server.ShutdownAsync().Wait(); } diff --git a/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs b/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs index 5646fed3d96..02b08d2a10c 100644 --- a/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs +++ b/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs @@ -127,6 +127,10 @@ namespace Grpc.Core /// Otherwise, requests cancellation of the call which should terminate all pending async operations associated with the call. /// As a result, all resources being used by the call should be released eventually. /// + /// + /// Normally, there is no need for you to dispose the call unless you want to utilize the + /// "Cancel" semantics of invoking Dispose. + /// public void Dispose() { disposeAction.Invoke(); diff --git a/src/csharp/Grpc.Core/ServerServiceDefinition.cs b/src/csharp/Grpc.Core/ServerServiceDefinition.cs index deb1431ca36..ac08c04bf6a 100644 --- a/src/csharp/Grpc.Core/ServerServiceDefinition.cs +++ b/src/csharp/Grpc.Core/ServerServiceDefinition.cs @@ -63,11 +63,10 @@ namespace Grpc.Core /// /// Creates a new builder object for ServerServiceDefinition. /// - /// The service name. /// The builder object. - public static Builder CreateBuilder(string serviceName) + public static Builder CreateBuilder() { - return new Builder(serviceName); + return new Builder(); } /// @@ -75,16 +74,13 @@ namespace Grpc.Core /// public class Builder { - readonly string serviceName; readonly Dictionary callHandlers = new Dictionary(); /// /// Creates a new instance of builder. /// - /// The service name. - public Builder(string serviceName) + public Builder() { - this.serviceName = serviceName; } /// diff --git a/src/csharp/Grpc.IntegrationTesting/GenericService.cs b/src/csharp/Grpc.IntegrationTesting/GenericService.cs index c6128264ac5..53fa1ee5f60 100644 --- a/src/csharp/Grpc.IntegrationTesting/GenericService.cs +++ b/src/csharp/Grpc.IntegrationTesting/GenericService.cs @@ -64,7 +64,7 @@ namespace Grpc.IntegrationTesting public static ServerServiceDefinition BindHandler(DuplexStreamingServerMethod handler) { - return ServerServiceDefinition.CreateBuilder(StreamingCallMethod.ServiceName) + return ServerServiceDefinition.CreateBuilder() .AddMethod(StreamingCallMethod, handler).Build(); } } From 562cd05bc97e24b2cba82777a8e8621fcc8ace37 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 6 Jun 2016 08:47:17 -0700 Subject: [PATCH 2/3] update C# codegen and regenerate --- src/compiler/csharp_generator.cc | 4 +--- src/csharp/Grpc.Examples/MathGrpc.cs | 4 ++-- src/csharp/Grpc.HealthCheck/HealthGrpc.cs | 4 ++-- src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs | 4 ++-- src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs | 8 ++++---- src/csharp/Grpc.IntegrationTesting/TestGrpc.cs | 12 ++++++------ 6 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/compiler/csharp_generator.cc b/src/compiler/csharp_generator.cc index 484fa3cdcc4..7bf05483415 100644 --- a/src/compiler/csharp_generator.cc +++ b/src/compiler/csharp_generator.cc @@ -559,9 +559,7 @@ void GenerateBindServiceMethod(Printer* out, const ServiceDescriptor *service, out->Print("{\n"); out->Indent(); - out->Print( - "return ServerServiceDefinition.CreateBuilder($servicenamefield$)\n", - "servicenamefield", GetServiceNameFieldName()); + out->Print("return ServerServiceDefinition.CreateBuilder()\n"); out->Indent(); out->Indent(); for (int i = 0; i < service->method_count(); i++) { diff --git a/src/csharp/Grpc.Examples/MathGrpc.cs b/src/csharp/Grpc.Examples/MathGrpc.cs index d700a18778b..0bc7b8c06e7 100644 --- a/src/csharp/Grpc.Examples/MathGrpc.cs +++ b/src/csharp/Grpc.Examples/MathGrpc.cs @@ -339,7 +339,7 @@ namespace Math { public static ServerServiceDefinition BindService(IMath serviceImpl) #pragma warning restore 0618 { - return ServerServiceDefinition.CreateBuilder(__ServiceName) + return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_Div, serviceImpl.Div) .AddMethod(__Method_DivMany, serviceImpl.DivMany) .AddMethod(__Method_Fib, serviceImpl.Fib) @@ -351,7 +351,7 @@ namespace Math { public static ServerServiceDefinition BindService(MathBase serviceImpl) #pragma warning restore 0618 { - return ServerServiceDefinition.CreateBuilder(__ServiceName) + return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_Div, serviceImpl.Div) .AddMethod(__Method_DivMany, serviceImpl.DivMany) .AddMethod(__Method_Fib, serviceImpl.Fib) diff --git a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs index 51c6a39b1d8..40f9b95ae30 100644 --- a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs +++ b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs @@ -138,7 +138,7 @@ namespace Grpc.Health.V1 { public static ServerServiceDefinition BindService(IHealth serviceImpl) #pragma warning restore 0618 { - return ServerServiceDefinition.CreateBuilder(__ServiceName) + return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_Check, serviceImpl.Check).Build(); } @@ -147,7 +147,7 @@ namespace Grpc.Health.V1 { public static ServerServiceDefinition BindService(HealthBase serviceImpl) #pragma warning restore 0618 { - return ServerServiceDefinition.CreateBuilder(__ServiceName) + return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_Check, serviceImpl.Check).Build(); } diff --git a/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs b/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs index 9d31d1c5146..8c64f4ff728 100644 --- a/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs @@ -222,7 +222,7 @@ namespace Grpc.Testing { public static ServerServiceDefinition BindService(IMetricsService serviceImpl) #pragma warning restore 0618 { - return ServerServiceDefinition.CreateBuilder(__ServiceName) + return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_GetAllGauges, serviceImpl.GetAllGauges) .AddMethod(__Method_GetGauge, serviceImpl.GetGauge).Build(); } @@ -232,7 +232,7 @@ namespace Grpc.Testing { public static ServerServiceDefinition BindService(MetricsServiceBase serviceImpl) #pragma warning restore 0618 { - return ServerServiceDefinition.CreateBuilder(__ServiceName) + return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_GetAllGauges, serviceImpl.GetAllGauges) .AddMethod(__Method_GetGauge, serviceImpl.GetGauge).Build(); } diff --git a/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs b/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs index f7071ebf6be..171945e56e7 100644 --- a/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs @@ -227,7 +227,7 @@ namespace Grpc.Testing { public static ServerServiceDefinition BindService(IBenchmarkService serviceImpl) #pragma warning restore 0618 { - return ServerServiceDefinition.CreateBuilder(__ServiceName) + return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_UnaryCall, serviceImpl.UnaryCall) .AddMethod(__Method_StreamingCall, serviceImpl.StreamingCall).Build(); } @@ -237,7 +237,7 @@ namespace Grpc.Testing { public static ServerServiceDefinition BindService(BenchmarkServiceBase serviceImpl) #pragma warning restore 0618 { - return ServerServiceDefinition.CreateBuilder(__ServiceName) + return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_UnaryCall, serviceImpl.UnaryCall) .AddMethod(__Method_StreamingCall, serviceImpl.StreamingCall).Build(); } @@ -583,7 +583,7 @@ namespace Grpc.Testing { public static ServerServiceDefinition BindService(IWorkerService serviceImpl) #pragma warning restore 0618 { - return ServerServiceDefinition.CreateBuilder(__ServiceName) + return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_RunServer, serviceImpl.RunServer) .AddMethod(__Method_RunClient, serviceImpl.RunClient) .AddMethod(__Method_CoreCount, serviceImpl.CoreCount) @@ -595,7 +595,7 @@ namespace Grpc.Testing { public static ServerServiceDefinition BindService(WorkerServiceBase serviceImpl) #pragma warning restore 0618 { - return ServerServiceDefinition.CreateBuilder(__ServiceName) + return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_RunServer, serviceImpl.RunServer) .AddMethod(__Method_RunClient, serviceImpl.RunClient) .AddMethod(__Method_CoreCount, serviceImpl.CoreCount) diff --git a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs index cf43a77118c..9e356519556 100644 --- a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs @@ -449,7 +449,7 @@ namespace Grpc.Testing { public static ServerServiceDefinition BindService(ITestService serviceImpl) #pragma warning restore 0618 { - return ServerServiceDefinition.CreateBuilder(__ServiceName) + return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_EmptyCall, serviceImpl.EmptyCall) .AddMethod(__Method_UnaryCall, serviceImpl.UnaryCall) .AddMethod(__Method_StreamingOutputCall, serviceImpl.StreamingOutputCall) @@ -463,7 +463,7 @@ namespace Grpc.Testing { public static ServerServiceDefinition BindService(TestServiceBase serviceImpl) #pragma warning restore 0618 { - return ServerServiceDefinition.CreateBuilder(__ServiceName) + return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_EmptyCall, serviceImpl.EmptyCall) .AddMethod(__Method_UnaryCall, serviceImpl.UnaryCall) .AddMethod(__Method_StreamingOutputCall, serviceImpl.StreamingOutputCall) @@ -606,7 +606,7 @@ namespace Grpc.Testing { public static ServerServiceDefinition BindService(IUnimplementedService serviceImpl) #pragma warning restore 0618 { - return ServerServiceDefinition.CreateBuilder(__ServiceName) + return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_UnimplementedCall, serviceImpl.UnimplementedCall).Build(); } @@ -615,7 +615,7 @@ namespace Grpc.Testing { public static ServerServiceDefinition BindService(UnimplementedServiceBase serviceImpl) #pragma warning restore 0618 { - return ServerServiceDefinition.CreateBuilder(__ServiceName) + return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_UnimplementedCall, serviceImpl.UnimplementedCall).Build(); } @@ -757,7 +757,7 @@ namespace Grpc.Testing { public static ServerServiceDefinition BindService(IReconnectService serviceImpl) #pragma warning restore 0618 { - return ServerServiceDefinition.CreateBuilder(__ServiceName) + return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_Start, serviceImpl.Start) .AddMethod(__Method_Stop, serviceImpl.Stop).Build(); } @@ -767,7 +767,7 @@ namespace Grpc.Testing { public static ServerServiceDefinition BindService(ReconnectServiceBase serviceImpl) #pragma warning restore 0618 { - return ServerServiceDefinition.CreateBuilder(__ServiceName) + return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_Start, serviceImpl.Start) .AddMethod(__Method_Stop, serviceImpl.Stop).Build(); } From fcc8d971ff8b46bf88e0231fda713b274597af99 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 6 Jun 2016 09:44:02 -0700 Subject: [PATCH 3/3] get rid of deprecated server and client interface --- src/compiler/csharp_generator.cc | 112 +-------- src/csharp/Grpc.Examples/MathGrpc.cs | 109 +-------- src/csharp/Grpc.HealthCheck/HealthGrpc.cs | 32 +-- .../Grpc.IntegrationTesting/MetricsGrpc.cs | 63 +---- .../Grpc.IntegrationTesting/ServicesGrpc.cs | 192 +-------------- .../Grpc.IntegrationTesting/TestGrpc.cs | 226 +----------------- 6 files changed, 14 insertions(+), 720 deletions(-) diff --git a/src/compiler/csharp_generator.cc b/src/compiler/csharp_generator.cc index 7bf05483415..fc8feaf0fcc 100644 --- a/src/compiler/csharp_generator.cc +++ b/src/compiler/csharp_generator.cc @@ -119,18 +119,10 @@ std::string GetServiceClassName(const ServiceDescriptor* service) { return service->name(); } -std::string GetClientInterfaceName(const ServiceDescriptor* service) { - return "I" + service->name() + "Client"; -} - std::string GetClientClassName(const ServiceDescriptor* service) { return service->name() + "Client"; } -std::string GetServerInterfaceName(const ServiceDescriptor* service) { - return "I" + service->name(); -} - std::string GetServerClassName(const ServiceDescriptor* service) { return service->name() + "Base"; } @@ -302,86 +294,6 @@ void GenerateServiceDescriptorProperty(Printer* out, const ServiceDescriptor *se out->Print("\n"); } -void GenerateClientInterface(Printer* out, const ServiceDescriptor *service) { - out->Print("/// Client for $servicename$\n", - "servicename", GetServiceClassName(service)); - out->Print("[System.Obsolete(\"Client side interfaced will be removed " - "in the next release. Use client class directly.\")]\n"); - out->Print("public interface $name$\n", "name", - GetClientInterfaceName(service)); - out->Print("{\n"); - out->Indent(); - for (int i = 0; i < service->method_count(); i++) { - const MethodDescriptor *method = service->method(i); - MethodType method_type = GetMethodType(method); - - if (method_type == METHODTYPE_NO_STREAMING) { - // unary calls have an extra synchronous stub method - GenerateDocCommentBody(out, method); - out->Print( - "$response$ $methodname$($request$ request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));\n", - "methodname", method->name(), "request", - GetClassName(method->input_type()), "response", - GetClassName(method->output_type())); - - // overload taking CallOptions as a param - GenerateDocCommentBody(out, method); - out->Print( - "$response$ $methodname$($request$ request, CallOptions options);\n", - "methodname", method->name(), "request", - GetClassName(method->input_type()), "response", - GetClassName(method->output_type())); - } - - std::string method_name = method->name(); - if (method_type == METHODTYPE_NO_STREAMING) { - method_name += "Async"; // prevent name clash with synchronous method. - } - GenerateDocCommentBody(out, method); - out->Print( - "$returntype$ $methodname$($request_maybe$Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));\n", - "methodname", method_name, "request_maybe", - GetMethodRequestParamMaybe(method), "returntype", - GetMethodReturnTypeClient(method)); - - // overload taking CallOptions as a param - GenerateDocCommentBody(out, method); - out->Print( - "$returntype$ $methodname$($request_maybe$CallOptions options);\n", - "methodname", method_name, "request_maybe", - GetMethodRequestParamMaybe(method), "returntype", - GetMethodReturnTypeClient(method)); - } - out->Outdent(); - out->Print("}\n"); - out->Print("\n"); -} - -void GenerateServerInterface(Printer* out, const ServiceDescriptor *service) { - out->Print("/// Interface of server-side implementations of $servicename$\n", - "servicename", GetServiceClassName(service)); - out->Print("[System.Obsolete(\"Service implementations should inherit" - " from the generated abstract base class instead.\")]\n"); - out->Print("public interface $name$\n", "name", - GetServerInterfaceName(service)); - out->Print("{\n"); - out->Indent(); - for (int i = 0; i < service->method_count(); i++) { - const MethodDescriptor *method = service->method(i); - GenerateDocCommentBody(out, method); - out->Print( - "$returntype$ $methodname$($request$$response_stream_maybe$, " - "ServerCallContext context);\n", - "methodname", method->name(), "returntype", - GetMethodReturnTypeServer(method), "request", - GetMethodRequestParamServer(method), "response_stream_maybe", - GetMethodResponseStreamMaybe(method)); - } - out->Outdent(); - out->Print("}\n"); - out->Print("\n"); -} - void GenerateServerClass(Printer* out, const ServiceDescriptor *service) { out->Print("/// Base class for server-side implementations of $servicename$\n", "servicename", GetServiceClassName(service)); @@ -414,12 +326,9 @@ void GenerateServerClass(Printer* out, const ServiceDescriptor *service) { void GenerateClientStub(Printer* out, const ServiceDescriptor *service) { out->Print("/// Client for $servicename$\n", "servicename", GetServiceClassName(service)); - out->Print("#pragma warning disable 0618\n"); out->Print( - "public class $name$ : ClientBase<$name$>, $interface$\n", - "name", GetClientClassName(service), - "interface", GetClientInterfaceName(service)); - out->Print("#pragma warning restore 0618\n"); + "public class $name$ : ClientBase<$name$>\n", + "name", GetClientClassName(service)); out->Print("{\n"); out->Indent(); @@ -546,16 +455,12 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor *service) { out->Print("\n"); } -void GenerateBindServiceMethod(Printer* out, const ServiceDescriptor *service, - bool use_server_class) { +void GenerateBindServiceMethod(Printer* out, const ServiceDescriptor *service) { out->Print( "/// Creates service definition that can be registered with a server\n"); - out->Print("#pragma warning disable 0618\n"); out->Print( - "public static ServerServiceDefinition BindService($interface$ serviceImpl)\n", - "interface", use_server_class ? GetServerClassName(service) : - GetServerInterfaceName(service)); - out->Print("#pragma warning restore 0618\n"); + "public static ServerServiceDefinition BindService($implclass$ serviceImpl)\n", + "implclass", GetServerClassName(service)); out->Print("{\n"); out->Indent(); @@ -614,11 +519,7 @@ void GenerateService(Printer* out, const ServiceDescriptor *service, } GenerateServiceDescriptorProperty(out, service); - if (generate_client) { - GenerateClientInterface(out, service); - } if (generate_server) { - GenerateServerInterface(out, service); GenerateServerClass(out, service); } if (generate_client) { @@ -626,8 +527,7 @@ void GenerateService(Printer* out, const ServiceDescriptor *service, GenerateNewStubMethods(out, service); } if (generate_server) { - GenerateBindServiceMethod(out, service, false); - GenerateBindServiceMethod(out, service, true); + GenerateBindServiceMethod(out, service); } out->Outdent(); diff --git a/src/csharp/Grpc.Examples/MathGrpc.cs b/src/csharp/Grpc.Examples/MathGrpc.cs index 0bc7b8c06e7..9319e311ee6 100644 --- a/src/csharp/Grpc.Examples/MathGrpc.cs +++ b/src/csharp/Grpc.Examples/MathGrpc.cs @@ -81,97 +81,6 @@ namespace Math { get { return global::Math.MathReflection.Descriptor.Services[0]; } } - /// Client for Math - [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")] - public interface IMathClient - { - /// - /// Div divides args.dividend by args.divisor and returns the quotient and - /// remainder. - /// - global::Math.DivReply Div(global::Math.DivArgs request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Div divides args.dividend by args.divisor and returns the quotient and - /// remainder. - /// - global::Math.DivReply Div(global::Math.DivArgs request, CallOptions options); - /// - /// Div divides args.dividend by args.divisor and returns the quotient and - /// remainder. - /// - AsyncUnaryCall DivAsync(global::Math.DivArgs request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Div divides args.dividend by args.divisor and returns the quotient and - /// remainder. - /// - AsyncUnaryCall DivAsync(global::Math.DivArgs request, CallOptions options); - /// - /// DivMany accepts an arbitrary number of division args from the client stream - /// and sends back the results in the reply stream. The stream continues until - /// the client closes its end; the server does the same after sending all the - /// replies. The stream ends immediately if either end aborts. - /// - AsyncDuplexStreamingCall DivMany(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// DivMany accepts an arbitrary number of division args from the client stream - /// and sends back the results in the reply stream. The stream continues until - /// the client closes its end; the server does the same after sending all the - /// replies. The stream ends immediately if either end aborts. - /// - AsyncDuplexStreamingCall DivMany(CallOptions options); - /// - /// Fib generates numbers in the Fibonacci sequence. If args.limit > 0, Fib - /// generates up to limit numbers; otherwise it continues until the call is - /// canceled. Unlike Fib above, Fib has no final FibReply. - /// - AsyncServerStreamingCall Fib(global::Math.FibArgs request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Fib generates numbers in the Fibonacci sequence. If args.limit > 0, Fib - /// generates up to limit numbers; otherwise it continues until the call is - /// canceled. Unlike Fib above, Fib has no final FibReply. - /// - AsyncServerStreamingCall Fib(global::Math.FibArgs request, CallOptions options); - /// - /// Sum sums a stream of numbers, returning the final result once the stream - /// is closed. - /// - AsyncClientStreamingCall Sum(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Sum sums a stream of numbers, returning the final result once the stream - /// is closed. - /// - AsyncClientStreamingCall Sum(CallOptions options); - } - - /// Interface of server-side implementations of Math - [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")] - public interface IMath - { - /// - /// Div divides args.dividend by args.divisor and returns the quotient and - /// remainder. - /// - global::System.Threading.Tasks.Task Div(global::Math.DivArgs request, ServerCallContext context); - /// - /// DivMany accepts an arbitrary number of division args from the client stream - /// and sends back the results in the reply stream. The stream continues until - /// the client closes its end; the server does the same after sending all the - /// replies. The stream ends immediately if either end aborts. - /// - global::System.Threading.Tasks.Task DivMany(IAsyncStreamReader requestStream, IServerStreamWriter responseStream, ServerCallContext context); - /// - /// Fib generates numbers in the Fibonacci sequence. If args.limit > 0, Fib - /// generates up to limit numbers; otherwise it continues until the call is - /// canceled. Unlike Fib above, Fib has no final FibReply. - /// - global::System.Threading.Tasks.Task Fib(global::Math.FibArgs request, IServerStreamWriter responseStream, ServerCallContext context); - /// - /// Sum sums a stream of numbers, returning the final result once the stream - /// is closed. - /// - global::System.Threading.Tasks.Task Sum(IAsyncStreamReader requestStream, ServerCallContext context); - } - /// Base class for server-side implementations of Math public abstract class MathBase { @@ -217,9 +126,7 @@ namespace Math { } /// Client for Math - #pragma warning disable 0618 - public class MathClient : ClientBase, IMathClient - #pragma warning restore 0618 + public class MathClient : ClientBase { public MathClient(Channel channel) : base(channel) { @@ -335,21 +242,7 @@ namespace Math { } /// Creates service definition that can be registered with a server - #pragma warning disable 0618 - public static ServerServiceDefinition BindService(IMath serviceImpl) - #pragma warning restore 0618 - { - return ServerServiceDefinition.CreateBuilder() - .AddMethod(__Method_Div, serviceImpl.Div) - .AddMethod(__Method_DivMany, serviceImpl.DivMany) - .AddMethod(__Method_Fib, serviceImpl.Fib) - .AddMethod(__Method_Sum, serviceImpl.Sum).Build(); - } - - /// Creates service definition that can be registered with a server - #pragma warning disable 0618 public static ServerServiceDefinition BindService(MathBase serviceImpl) - #pragma warning restore 0618 { return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_Div, serviceImpl.Div) diff --git a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs index 40f9b95ae30..d0ade7d02be 100644 --- a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs +++ b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs @@ -58,23 +58,6 @@ namespace Grpc.Health.V1 { get { return global::Grpc.Health.V1.HealthReflection.Descriptor.Services[0]; } } - /// Client for Health - [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")] - public interface IHealthClient - { - global::Grpc.Health.V1.HealthCheckResponse Check(global::Grpc.Health.V1.HealthCheckRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - global::Grpc.Health.V1.HealthCheckResponse Check(global::Grpc.Health.V1.HealthCheckRequest request, CallOptions options); - AsyncUnaryCall CheckAsync(global::Grpc.Health.V1.HealthCheckRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - AsyncUnaryCall CheckAsync(global::Grpc.Health.V1.HealthCheckRequest request, CallOptions options); - } - - /// Interface of server-side implementations of Health - [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")] - public interface IHealth - { - global::System.Threading.Tasks.Task Check(global::Grpc.Health.V1.HealthCheckRequest request, ServerCallContext context); - } - /// Base class for server-side implementations of Health public abstract class HealthBase { @@ -86,9 +69,7 @@ namespace Grpc.Health.V1 { } /// Client for Health - #pragma warning disable 0618 - public class HealthClient : ClientBase, IHealthClient - #pragma warning restore 0618 + public class HealthClient : ClientBase { public HealthClient(Channel channel) : base(channel) { @@ -134,18 +115,7 @@ namespace Grpc.Health.V1 { } /// Creates service definition that can be registered with a server - #pragma warning disable 0618 - public static ServerServiceDefinition BindService(IHealth serviceImpl) - #pragma warning restore 0618 - { - return ServerServiceDefinition.CreateBuilder() - .AddMethod(__Method_Check, serviceImpl.Check).Build(); - } - - /// Creates service definition that can be registered with a server - #pragma warning disable 0618 public static ServerServiceDefinition BindService(HealthBase serviceImpl) - #pragma warning restore 0618 { return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_Check, serviceImpl.Check).Build(); diff --git a/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs b/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs index 8c64f4ff728..22bd27ec0aa 100644 --- a/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs @@ -72,53 +72,6 @@ namespace Grpc.Testing { get { return global::Grpc.Testing.MetricsReflection.Descriptor.Services[0]; } } - /// Client for MetricsService - [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")] - public interface IMetricsServiceClient - { - /// - /// Returns the values of all the gauges that are currently being maintained by - /// the service - /// - AsyncServerStreamingCall GetAllGauges(global::Grpc.Testing.EmptyMessage request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns the values of all the gauges that are currently being maintained by - /// the service - /// - AsyncServerStreamingCall GetAllGauges(global::Grpc.Testing.EmptyMessage request, CallOptions options); - /// - /// Returns the value of one gauge - /// - global::Grpc.Testing.GaugeResponse GetGauge(global::Grpc.Testing.GaugeRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns the value of one gauge - /// - global::Grpc.Testing.GaugeResponse GetGauge(global::Grpc.Testing.GaugeRequest request, CallOptions options); - /// - /// Returns the value of one gauge - /// - AsyncUnaryCall GetGaugeAsync(global::Grpc.Testing.GaugeRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns the value of one gauge - /// - AsyncUnaryCall GetGaugeAsync(global::Grpc.Testing.GaugeRequest request, CallOptions options); - } - - /// Interface of server-side implementations of MetricsService - [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")] - public interface IMetricsService - { - /// - /// Returns the values of all the gauges that are currently being maintained by - /// the service - /// - global::System.Threading.Tasks.Task GetAllGauges(global::Grpc.Testing.EmptyMessage request, IServerStreamWriter responseStream, ServerCallContext context); - /// - /// Returns the value of one gauge - /// - global::System.Threading.Tasks.Task GetGauge(global::Grpc.Testing.GaugeRequest request, ServerCallContext context); - } - /// Base class for server-side implementations of MetricsService public abstract class MetricsServiceBase { @@ -142,9 +95,7 @@ namespace Grpc.Testing { } /// Client for MetricsService - #pragma warning disable 0618 - public class MetricsServiceClient : ClientBase, IMetricsServiceClient - #pragma warning restore 0618 + public class MetricsServiceClient : ClientBase { public MetricsServiceClient(Channel channel) : base(channel) { @@ -218,19 +169,7 @@ namespace Grpc.Testing { } /// Creates service definition that can be registered with a server - #pragma warning disable 0618 - public static ServerServiceDefinition BindService(IMetricsService serviceImpl) - #pragma warning restore 0618 - { - return ServerServiceDefinition.CreateBuilder() - .AddMethod(__Method_GetAllGauges, serviceImpl.GetAllGauges) - .AddMethod(__Method_GetGauge, serviceImpl.GetGauge).Build(); - } - - /// Creates service definition that can be registered with a server - #pragma warning disable 0618 public static ServerServiceDefinition BindService(MetricsServiceBase serviceImpl) - #pragma warning restore 0618 { return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_GetAllGauges, serviceImpl.GetAllGauges) diff --git a/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs b/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs index 171945e56e7..9c99296115c 100644 --- a/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs @@ -67,58 +67,6 @@ namespace Grpc.Testing { get { return global::Grpc.Testing.ServicesReflection.Descriptor.Services[0]; } } - /// Client for BenchmarkService - [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")] - public interface IBenchmarkServiceClient - { - /// - /// One request followed by one response. - /// The server returns the client payload as-is. - /// - global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// One request followed by one response. - /// The server returns the client payload as-is. - /// - global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, CallOptions options); - /// - /// One request followed by one response. - /// The server returns the client payload as-is. - /// - AsyncUnaryCall UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// One request followed by one response. - /// The server returns the client payload as-is. - /// - AsyncUnaryCall UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, CallOptions options); - /// - /// One request followed by one response. - /// The server returns the client payload as-is. - /// - AsyncDuplexStreamingCall StreamingCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// One request followed by one response. - /// The server returns the client payload as-is. - /// - AsyncDuplexStreamingCall StreamingCall(CallOptions options); - } - - /// Interface of server-side implementations of BenchmarkService - [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")] - public interface IBenchmarkService - { - /// - /// One request followed by one response. - /// The server returns the client payload as-is. - /// - global::System.Threading.Tasks.Task UnaryCall(global::Grpc.Testing.SimpleRequest request, ServerCallContext context); - /// - /// One request followed by one response. - /// The server returns the client payload as-is. - /// - global::System.Threading.Tasks.Task StreamingCall(IAsyncStreamReader requestStream, IServerStreamWriter responseStream, ServerCallContext context); - } - /// Base class for server-side implementations of BenchmarkService public abstract class BenchmarkServiceBase { @@ -143,9 +91,7 @@ namespace Grpc.Testing { } /// Client for BenchmarkService - #pragma warning disable 0618 - public class BenchmarkServiceClient : ClientBase, IBenchmarkServiceClient - #pragma warning restore 0618 + public class BenchmarkServiceClient : ClientBase { public BenchmarkServiceClient(Channel channel) : base(channel) { @@ -223,19 +169,7 @@ namespace Grpc.Testing { } /// Creates service definition that can be registered with a server - #pragma warning disable 0618 - public static ServerServiceDefinition BindService(IBenchmarkService serviceImpl) - #pragma warning restore 0618 - { - return ServerServiceDefinition.CreateBuilder() - .AddMethod(__Method_UnaryCall, serviceImpl.UnaryCall) - .AddMethod(__Method_StreamingCall, serviceImpl.StreamingCall).Build(); - } - - /// Creates service definition that can be registered with a server - #pragma warning disable 0618 public static ServerServiceDefinition BindService(BenchmarkServiceBase serviceImpl) - #pragma warning restore 0618 { return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_UnaryCall, serviceImpl.UnaryCall) @@ -289,112 +223,6 @@ namespace Grpc.Testing { get { return global::Grpc.Testing.ServicesReflection.Descriptor.Services[1]; } } - /// Client for WorkerService - [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")] - public interface IWorkerServiceClient - { - /// - /// Start server with specified workload. - /// First request sent specifies the ServerConfig followed by ServerStatus - /// response. After that, a "Mark" can be sent anytime to request the latest - /// stats. Closing the stream will initiate shutdown of the test server - /// and once the shutdown has finished, the OK status is sent to terminate - /// this RPC. - /// - AsyncDuplexStreamingCall RunServer(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Start server with specified workload. - /// First request sent specifies the ServerConfig followed by ServerStatus - /// response. After that, a "Mark" can be sent anytime to request the latest - /// stats. Closing the stream will initiate shutdown of the test server - /// and once the shutdown has finished, the OK status is sent to terminate - /// this RPC. - /// - AsyncDuplexStreamingCall RunServer(CallOptions options); - /// - /// Start client with specified workload. - /// First request sent specifies the ClientConfig followed by ClientStatus - /// response. After that, a "Mark" can be sent anytime to request the latest - /// stats. Closing the stream will initiate shutdown of the test client - /// and once the shutdown has finished, the OK status is sent to terminate - /// this RPC. - /// - AsyncDuplexStreamingCall RunClient(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Start client with specified workload. - /// First request sent specifies the ClientConfig followed by ClientStatus - /// response. After that, a "Mark" can be sent anytime to request the latest - /// stats. Closing the stream will initiate shutdown of the test client - /// and once the shutdown has finished, the OK status is sent to terminate - /// this RPC. - /// - AsyncDuplexStreamingCall RunClient(CallOptions options); - /// - /// Just return the core count - unary call - /// - global::Grpc.Testing.CoreResponse CoreCount(global::Grpc.Testing.CoreRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Just return the core count - unary call - /// - global::Grpc.Testing.CoreResponse CoreCount(global::Grpc.Testing.CoreRequest request, CallOptions options); - /// - /// Just return the core count - unary call - /// - AsyncUnaryCall CoreCountAsync(global::Grpc.Testing.CoreRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Just return the core count - unary call - /// - AsyncUnaryCall CoreCountAsync(global::Grpc.Testing.CoreRequest request, CallOptions options); - /// - /// Quit this worker - /// - global::Grpc.Testing.Void QuitWorker(global::Grpc.Testing.Void request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Quit this worker - /// - global::Grpc.Testing.Void QuitWorker(global::Grpc.Testing.Void request, CallOptions options); - /// - /// Quit this worker - /// - AsyncUnaryCall QuitWorkerAsync(global::Grpc.Testing.Void request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Quit this worker - /// - AsyncUnaryCall QuitWorkerAsync(global::Grpc.Testing.Void request, CallOptions options); - } - - /// Interface of server-side implementations of WorkerService - [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")] - public interface IWorkerService - { - /// - /// Start server with specified workload. - /// First request sent specifies the ServerConfig followed by ServerStatus - /// response. After that, a "Mark" can be sent anytime to request the latest - /// stats. Closing the stream will initiate shutdown of the test server - /// and once the shutdown has finished, the OK status is sent to terminate - /// this RPC. - /// - global::System.Threading.Tasks.Task RunServer(IAsyncStreamReader requestStream, IServerStreamWriter responseStream, ServerCallContext context); - /// - /// Start client with specified workload. - /// First request sent specifies the ClientConfig followed by ClientStatus - /// response. After that, a "Mark" can be sent anytime to request the latest - /// stats. Closing the stream will initiate shutdown of the test client - /// and once the shutdown has finished, the OK status is sent to terminate - /// this RPC. - /// - global::System.Threading.Tasks.Task RunClient(IAsyncStreamReader requestStream, IServerStreamWriter responseStream, ServerCallContext context); - /// - /// Just return the core count - unary call - /// - global::System.Threading.Tasks.Task CoreCount(global::Grpc.Testing.CoreRequest request, ServerCallContext context); - /// - /// Quit this worker - /// - global::System.Threading.Tasks.Task QuitWorker(global::Grpc.Testing.Void request, ServerCallContext context); - } - /// Base class for server-side implementations of WorkerService public abstract class WorkerServiceBase { @@ -443,9 +271,7 @@ namespace Grpc.Testing { } /// Client for WorkerService - #pragma warning disable 0618 - public class WorkerServiceClient : ClientBase, IWorkerServiceClient - #pragma warning restore 0618 + public class WorkerServiceClient : ClientBase { public WorkerServiceClient(Channel channel) : base(channel) { @@ -579,21 +405,7 @@ namespace Grpc.Testing { } /// Creates service definition that can be registered with a server - #pragma warning disable 0618 - public static ServerServiceDefinition BindService(IWorkerService serviceImpl) - #pragma warning restore 0618 - { - return ServerServiceDefinition.CreateBuilder() - .AddMethod(__Method_RunServer, serviceImpl.RunServer) - .AddMethod(__Method_RunClient, serviceImpl.RunClient) - .AddMethod(__Method_CoreCount, serviceImpl.CoreCount) - .AddMethod(__Method_QuitWorker, serviceImpl.QuitWorker).Build(); - } - - /// Creates service definition that can be registered with a server - #pragma warning disable 0618 public static ServerServiceDefinition BindService(WorkerServiceBase serviceImpl) - #pragma warning restore 0618 { return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_RunServer, serviceImpl.RunServer) diff --git a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs index 9e356519556..6c252013f84 100644 --- a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs @@ -105,127 +105,6 @@ namespace Grpc.Testing { get { return global::Grpc.Testing.TestReflection.Descriptor.Services[0]; } } - /// Client for TestService - [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")] - public interface ITestServiceClient - { - /// - /// One empty request followed by one empty response. - /// - global::Grpc.Testing.Empty EmptyCall(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// One empty request followed by one empty response. - /// - global::Grpc.Testing.Empty EmptyCall(global::Grpc.Testing.Empty request, CallOptions options); - /// - /// One empty request followed by one empty response. - /// - AsyncUnaryCall EmptyCallAsync(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// One empty request followed by one empty response. - /// - AsyncUnaryCall EmptyCallAsync(global::Grpc.Testing.Empty request, CallOptions options); - /// - /// One request followed by one response. - /// - global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// One request followed by one response. - /// - global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, CallOptions options); - /// - /// One request followed by one response. - /// - AsyncUnaryCall UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// One request followed by one response. - /// - AsyncUnaryCall UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, CallOptions options); - /// - /// One request followed by a sequence of responses (streamed download). - /// The server returns the payload with client desired type and sizes. - /// - AsyncServerStreamingCall StreamingOutputCall(global::Grpc.Testing.StreamingOutputCallRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// One request followed by a sequence of responses (streamed download). - /// The server returns the payload with client desired type and sizes. - /// - AsyncServerStreamingCall StreamingOutputCall(global::Grpc.Testing.StreamingOutputCallRequest request, CallOptions options); - /// - /// A sequence of requests followed by one response (streamed upload). - /// The server returns the aggregated size of client payload as the result. - /// - AsyncClientStreamingCall StreamingInputCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// A sequence of requests followed by one response (streamed upload). - /// The server returns the aggregated size of client payload as the result. - /// - AsyncClientStreamingCall StreamingInputCall(CallOptions options); - /// - /// A sequence of requests with each request served by the server immediately. - /// As one request could lead to multiple responses, this interface - /// demonstrates the idea of full duplexing. - /// - AsyncDuplexStreamingCall FullDuplexCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// A sequence of requests with each request served by the server immediately. - /// As one request could lead to multiple responses, this interface - /// demonstrates the idea of full duplexing. - /// - AsyncDuplexStreamingCall FullDuplexCall(CallOptions options); - /// - /// A sequence of requests followed by a sequence of responses. - /// 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 - /// first request. - /// - AsyncDuplexStreamingCall HalfDuplexCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// A sequence of requests followed by a sequence of responses. - /// 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 - /// first request. - /// - AsyncDuplexStreamingCall HalfDuplexCall(CallOptions options); - } - - /// Interface of server-side implementations of TestService - [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")] - public interface ITestService - { - /// - /// One empty request followed by one empty response. - /// - global::System.Threading.Tasks.Task EmptyCall(global::Grpc.Testing.Empty request, ServerCallContext context); - /// - /// One request followed by one response. - /// - global::System.Threading.Tasks.Task UnaryCall(global::Grpc.Testing.SimpleRequest request, ServerCallContext context); - /// - /// One request followed by a sequence of responses (streamed download). - /// The server returns the payload with client desired type and sizes. - /// - global::System.Threading.Tasks.Task StreamingOutputCall(global::Grpc.Testing.StreamingOutputCallRequest request, IServerStreamWriter responseStream, ServerCallContext context); - /// - /// A sequence of requests followed by one response (streamed upload). - /// The server returns the aggregated size of client payload as the result. - /// - global::System.Threading.Tasks.Task StreamingInputCall(IAsyncStreamReader requestStream, ServerCallContext context); - /// - /// A sequence of requests with each request served by the server immediately. - /// As one request could lead to multiple responses, this interface - /// demonstrates the idea of full duplexing. - /// - global::System.Threading.Tasks.Task FullDuplexCall(IAsyncStreamReader requestStream, IServerStreamWriter responseStream, ServerCallContext context); - /// - /// A sequence of requests followed by a sequence of responses. - /// 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 - /// first request. - /// - global::System.Threading.Tasks.Task HalfDuplexCall(IAsyncStreamReader requestStream, IServerStreamWriter responseStream, ServerCallContext context); - } - /// Base class for server-side implementations of TestService public abstract class TestServiceBase { @@ -287,9 +166,7 @@ namespace Grpc.Testing { } /// Client for TestService - #pragma warning disable 0618 - public class TestServiceClient : ClientBase, ITestServiceClient - #pragma warning restore 0618 + public class TestServiceClient : ClientBase { public TestServiceClient(Channel channel) : base(channel) { @@ -445,23 +322,7 @@ namespace Grpc.Testing { } /// Creates service definition that can be registered with a server - #pragma warning disable 0618 - public static ServerServiceDefinition BindService(ITestService serviceImpl) - #pragma warning restore 0618 - { - return ServerServiceDefinition.CreateBuilder() - .AddMethod(__Method_EmptyCall, serviceImpl.EmptyCall) - .AddMethod(__Method_UnaryCall, serviceImpl.UnaryCall) - .AddMethod(__Method_StreamingOutputCall, serviceImpl.StreamingOutputCall) - .AddMethod(__Method_StreamingInputCall, serviceImpl.StreamingInputCall) - .AddMethod(__Method_FullDuplexCall, serviceImpl.FullDuplexCall) - .AddMethod(__Method_HalfDuplexCall, serviceImpl.HalfDuplexCall).Build(); - } - - /// Creates service definition that can be registered with a server - #pragma warning disable 0618 public static ServerServiceDefinition BindService(TestServiceBase serviceImpl) - #pragma warning restore 0618 { return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_EmptyCall, serviceImpl.EmptyCall) @@ -496,38 +357,6 @@ namespace Grpc.Testing { get { return global::Grpc.Testing.TestReflection.Descriptor.Services[1]; } } - /// Client for UnimplementedService - [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")] - public interface IUnimplementedServiceClient - { - /// - /// A call that no server should implement - /// - global::Grpc.Testing.Empty UnimplementedCall(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// A call that no server should implement - /// - global::Grpc.Testing.Empty UnimplementedCall(global::Grpc.Testing.Empty request, CallOptions options); - /// - /// A call that no server should implement - /// - AsyncUnaryCall UnimplementedCallAsync(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// A call that no server should implement - /// - AsyncUnaryCall UnimplementedCallAsync(global::Grpc.Testing.Empty request, CallOptions options); - } - - /// Interface of server-side implementations of UnimplementedService - [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")] - public interface IUnimplementedService - { - /// - /// A call that no server should implement - /// - global::System.Threading.Tasks.Task UnimplementedCall(global::Grpc.Testing.Empty request, ServerCallContext context); - } - /// Base class for server-side implementations of UnimplementedService public abstract class UnimplementedServiceBase { @@ -542,9 +371,7 @@ namespace Grpc.Testing { } /// Client for UnimplementedService - #pragma warning disable 0618 - public class UnimplementedServiceClient : ClientBase, IUnimplementedServiceClient - #pragma warning restore 0618 + public class UnimplementedServiceClient : ClientBase { public UnimplementedServiceClient(Channel channel) : base(channel) { @@ -602,18 +429,7 @@ namespace Grpc.Testing { } /// Creates service definition that can be registered with a server - #pragma warning disable 0618 - public static ServerServiceDefinition BindService(IUnimplementedService serviceImpl) - #pragma warning restore 0618 - { - return ServerServiceDefinition.CreateBuilder() - .AddMethod(__Method_UnimplementedCall, serviceImpl.UnimplementedCall).Build(); - } - - /// Creates service definition that can be registered with a server - #pragma warning disable 0618 public static ServerServiceDefinition BindService(UnimplementedServiceBase serviceImpl) - #pragma warning restore 0618 { return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_UnimplementedCall, serviceImpl.UnimplementedCall).Build(); @@ -651,28 +467,6 @@ namespace Grpc.Testing { get { return global::Grpc.Testing.TestReflection.Descriptor.Services[2]; } } - /// Client for ReconnectService - [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")] - public interface IReconnectServiceClient - { - global::Grpc.Testing.Empty Start(global::Grpc.Testing.ReconnectParams request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - global::Grpc.Testing.Empty Start(global::Grpc.Testing.ReconnectParams request, CallOptions options); - AsyncUnaryCall StartAsync(global::Grpc.Testing.ReconnectParams request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - AsyncUnaryCall StartAsync(global::Grpc.Testing.ReconnectParams request, CallOptions options); - global::Grpc.Testing.ReconnectInfo Stop(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - global::Grpc.Testing.ReconnectInfo Stop(global::Grpc.Testing.Empty request, CallOptions options); - AsyncUnaryCall StopAsync(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)); - AsyncUnaryCall StopAsync(global::Grpc.Testing.Empty request, CallOptions options); - } - - /// Interface of server-side implementations of ReconnectService - [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")] - public interface IReconnectService - { - global::System.Threading.Tasks.Task Start(global::Grpc.Testing.ReconnectParams request, ServerCallContext context); - global::System.Threading.Tasks.Task Stop(global::Grpc.Testing.Empty request, ServerCallContext context); - } - /// Base class for server-side implementations of ReconnectService public abstract class ReconnectServiceBase { @@ -689,9 +483,7 @@ namespace Grpc.Testing { } /// Client for ReconnectService - #pragma warning disable 0618 - public class ReconnectServiceClient : ClientBase, IReconnectServiceClient - #pragma warning restore 0618 + public class ReconnectServiceClient : ClientBase { public ReconnectServiceClient(Channel channel) : base(channel) { @@ -753,19 +545,7 @@ namespace Grpc.Testing { } /// Creates service definition that can be registered with a server - #pragma warning disable 0618 - public static ServerServiceDefinition BindService(IReconnectService serviceImpl) - #pragma warning restore 0618 - { - return ServerServiceDefinition.CreateBuilder() - .AddMethod(__Method_Start, serviceImpl.Start) - .AddMethod(__Method_Stop, serviceImpl.Stop).Build(); - } - - /// Creates service definition that can be registered with a server - #pragma warning disable 0618 public static ServerServiceDefinition BindService(ReconnectServiceBase serviceImpl) - #pragma warning restore 0618 { return ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_Start, serviceImpl.Start)