ServicesGrpc.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. // Generated by the protocol buffer compiler. DO NOT EDIT!
  2. // source: src/proto/grpc/testing/services.proto
  3. #region Designer generated code
  4. using System;
  5. using System.Threading;
  6. using System.Threading.Tasks;
  7. using Grpc.Core;
  8. namespace Grpc.Testing {
  9. public static class BenchmarkService
  10. {
  11. static readonly string __ServiceName = "grpc.testing.BenchmarkService";
  12. static readonly Marshaller<global::Grpc.Testing.SimpleRequest> __Marshaller_SimpleRequest = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.SimpleRequest.Parser.ParseFrom);
  13. static readonly Marshaller<global::Grpc.Testing.SimpleResponse> __Marshaller_SimpleResponse = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.SimpleResponse.Parser.ParseFrom);
  14. static readonly Method<global::Grpc.Testing.SimpleRequest, global::Grpc.Testing.SimpleResponse> __Method_UnaryCall = new Method<global::Grpc.Testing.SimpleRequest, global::Grpc.Testing.SimpleResponse>(
  15. MethodType.Unary,
  16. __ServiceName,
  17. "UnaryCall",
  18. __Marshaller_SimpleRequest,
  19. __Marshaller_SimpleResponse);
  20. static readonly Method<global::Grpc.Testing.SimpleRequest, global::Grpc.Testing.SimpleResponse> __Method_StreamingCall = new Method<global::Grpc.Testing.SimpleRequest, global::Grpc.Testing.SimpleResponse>(
  21. MethodType.DuplexStreaming,
  22. __ServiceName,
  23. "StreamingCall",
  24. __Marshaller_SimpleRequest,
  25. __Marshaller_SimpleResponse);
  26. // service descriptor
  27. public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
  28. {
  29. get { return global::Grpc.Testing.ServicesReflection.Descriptor.Services[0]; }
  30. }
  31. // client interface
  32. [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")]
  33. public interface IBenchmarkServiceClient
  34. {
  35. global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));
  36. global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, CallOptions options);
  37. AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));
  38. AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, CallOptions options);
  39. AsyncDuplexStreamingCall<global::Grpc.Testing.SimpleRequest, global::Grpc.Testing.SimpleResponse> StreamingCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));
  40. AsyncDuplexStreamingCall<global::Grpc.Testing.SimpleRequest, global::Grpc.Testing.SimpleResponse> StreamingCall(CallOptions options);
  41. }
  42. // server-side interface
  43. [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")]
  44. public interface IBenchmarkService
  45. {
  46. Task<global::Grpc.Testing.SimpleResponse> UnaryCall(global::Grpc.Testing.SimpleRequest request, ServerCallContext context);
  47. Task StreamingCall(IAsyncStreamReader<global::Grpc.Testing.SimpleRequest> requestStream, IServerStreamWriter<global::Grpc.Testing.SimpleResponse> responseStream, ServerCallContext context);
  48. }
  49. // server-side abstract class
  50. public abstract class BenchmarkServiceBase
  51. {
  52. public virtual Task<global::Grpc.Testing.SimpleResponse> UnaryCall(global::Grpc.Testing.SimpleRequest request, ServerCallContext context)
  53. {
  54. throw new RpcException(new Status(StatusCode.Unimplemented, ""));
  55. }
  56. public virtual Task StreamingCall(IAsyncStreamReader<global::Grpc.Testing.SimpleRequest> requestStream, IServerStreamWriter<global::Grpc.Testing.SimpleResponse> responseStream, ServerCallContext context)
  57. {
  58. throw new RpcException(new Status(StatusCode.Unimplemented, ""));
  59. }
  60. }
  61. // client stub
  62. public class BenchmarkServiceClient : ClientBase<BenchmarkServiceClient>, IBenchmarkServiceClient
  63. {
  64. public BenchmarkServiceClient(Channel channel) : base(channel)
  65. {
  66. }
  67. public BenchmarkServiceClient(CallInvoker callInvoker) : base(callInvoker)
  68. {
  69. }
  70. ///<summary>Protected parameterless constructor to allow creation of test doubles.</summary>
  71. protected BenchmarkServiceClient() : base()
  72. {
  73. }
  74. ///<summary>Protected constructor to allow creation of configured clients.</summary>
  75. protected BenchmarkServiceClient(ClientBaseConfiguration configuration) : base(configuration)
  76. {
  77. }
  78. public virtual global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
  79. {
  80. return UnaryCall(request, new CallOptions(headers, deadline, cancellationToken));
  81. }
  82. public virtual global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, CallOptions options)
  83. {
  84. return CallInvoker.BlockingUnaryCall(__Method_UnaryCall, null, options, request);
  85. }
  86. public virtual AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
  87. {
  88. return UnaryCallAsync(request, new CallOptions(headers, deadline, cancellationToken));
  89. }
  90. public virtual AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, CallOptions options)
  91. {
  92. return CallInvoker.AsyncUnaryCall(__Method_UnaryCall, null, options, request);
  93. }
  94. public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.SimpleRequest, global::Grpc.Testing.SimpleResponse> StreamingCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
  95. {
  96. return StreamingCall(new CallOptions(headers, deadline, cancellationToken));
  97. }
  98. public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.SimpleRequest, global::Grpc.Testing.SimpleResponse> StreamingCall(CallOptions options)
  99. {
  100. return CallInvoker.AsyncDuplexStreamingCall(__Method_StreamingCall, null, options);
  101. }
  102. protected override BenchmarkServiceClient NewInstance(ClientBaseConfiguration configuration)
  103. {
  104. return new BenchmarkServiceClient(configuration);
  105. }
  106. }
  107. // creates service definition that can be registered with a server
  108. public static ServerServiceDefinition BindService(IBenchmarkService serviceImpl)
  109. {
  110. return ServerServiceDefinition.CreateBuilder(__ServiceName)
  111. .AddMethod(__Method_UnaryCall, serviceImpl.UnaryCall)
  112. .AddMethod(__Method_StreamingCall, serviceImpl.StreamingCall).Build();
  113. }
  114. // creates service definition that can be registered with a server
  115. public static ServerServiceDefinition BindService(BenchmarkServiceBase serviceImpl)
  116. {
  117. return ServerServiceDefinition.CreateBuilder(__ServiceName)
  118. .AddMethod(__Method_UnaryCall, serviceImpl.UnaryCall)
  119. .AddMethod(__Method_StreamingCall, serviceImpl.StreamingCall).Build();
  120. }
  121. // creates a new client
  122. public static BenchmarkServiceClient NewClient(Channel channel)
  123. {
  124. return new BenchmarkServiceClient(channel);
  125. }
  126. }
  127. public static class WorkerService
  128. {
  129. static readonly string __ServiceName = "grpc.testing.WorkerService";
  130. static readonly Marshaller<global::Grpc.Testing.ServerArgs> __Marshaller_ServerArgs = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.ServerArgs.Parser.ParseFrom);
  131. static readonly Marshaller<global::Grpc.Testing.ServerStatus> __Marshaller_ServerStatus = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.ServerStatus.Parser.ParseFrom);
  132. static readonly Marshaller<global::Grpc.Testing.ClientArgs> __Marshaller_ClientArgs = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.ClientArgs.Parser.ParseFrom);
  133. static readonly Marshaller<global::Grpc.Testing.ClientStatus> __Marshaller_ClientStatus = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.ClientStatus.Parser.ParseFrom);
  134. static readonly Marshaller<global::Grpc.Testing.CoreRequest> __Marshaller_CoreRequest = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.CoreRequest.Parser.ParseFrom);
  135. static readonly Marshaller<global::Grpc.Testing.CoreResponse> __Marshaller_CoreResponse = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.CoreResponse.Parser.ParseFrom);
  136. static readonly Marshaller<global::Grpc.Testing.Void> __Marshaller_Void = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.Void.Parser.ParseFrom);
  137. static readonly Method<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus> __Method_RunServer = new Method<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus>(
  138. MethodType.DuplexStreaming,
  139. __ServiceName,
  140. "RunServer",
  141. __Marshaller_ServerArgs,
  142. __Marshaller_ServerStatus);
  143. static readonly Method<global::Grpc.Testing.ClientArgs, global::Grpc.Testing.ClientStatus> __Method_RunClient = new Method<global::Grpc.Testing.ClientArgs, global::Grpc.Testing.ClientStatus>(
  144. MethodType.DuplexStreaming,
  145. __ServiceName,
  146. "RunClient",
  147. __Marshaller_ClientArgs,
  148. __Marshaller_ClientStatus);
  149. static readonly Method<global::Grpc.Testing.CoreRequest, global::Grpc.Testing.CoreResponse> __Method_CoreCount = new Method<global::Grpc.Testing.CoreRequest, global::Grpc.Testing.CoreResponse>(
  150. MethodType.Unary,
  151. __ServiceName,
  152. "CoreCount",
  153. __Marshaller_CoreRequest,
  154. __Marshaller_CoreResponse);
  155. static readonly Method<global::Grpc.Testing.Void, global::Grpc.Testing.Void> __Method_QuitWorker = new Method<global::Grpc.Testing.Void, global::Grpc.Testing.Void>(
  156. MethodType.Unary,
  157. __ServiceName,
  158. "QuitWorker",
  159. __Marshaller_Void,
  160. __Marshaller_Void);
  161. // service descriptor
  162. public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
  163. {
  164. get { return global::Grpc.Testing.ServicesReflection.Descriptor.Services[1]; }
  165. }
  166. // client interface
  167. [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")]
  168. public interface IWorkerServiceClient
  169. {
  170. AsyncDuplexStreamingCall<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus> RunServer(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));
  171. AsyncDuplexStreamingCall<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus> RunServer(CallOptions options);
  172. AsyncDuplexStreamingCall<global::Grpc.Testing.ClientArgs, global::Grpc.Testing.ClientStatus> RunClient(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));
  173. AsyncDuplexStreamingCall<global::Grpc.Testing.ClientArgs, global::Grpc.Testing.ClientStatus> RunClient(CallOptions options);
  174. global::Grpc.Testing.CoreResponse CoreCount(global::Grpc.Testing.CoreRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));
  175. global::Grpc.Testing.CoreResponse CoreCount(global::Grpc.Testing.CoreRequest request, CallOptions options);
  176. AsyncUnaryCall<global::Grpc.Testing.CoreResponse> CoreCountAsync(global::Grpc.Testing.CoreRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));
  177. AsyncUnaryCall<global::Grpc.Testing.CoreResponse> CoreCountAsync(global::Grpc.Testing.CoreRequest request, CallOptions options);
  178. global::Grpc.Testing.Void QuitWorker(global::Grpc.Testing.Void request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));
  179. global::Grpc.Testing.Void QuitWorker(global::Grpc.Testing.Void request, CallOptions options);
  180. AsyncUnaryCall<global::Grpc.Testing.Void> QuitWorkerAsync(global::Grpc.Testing.Void request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));
  181. AsyncUnaryCall<global::Grpc.Testing.Void> QuitWorkerAsync(global::Grpc.Testing.Void request, CallOptions options);
  182. }
  183. // server-side interface
  184. [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")]
  185. public interface IWorkerService
  186. {
  187. Task RunServer(IAsyncStreamReader<global::Grpc.Testing.ServerArgs> requestStream, IServerStreamWriter<global::Grpc.Testing.ServerStatus> responseStream, ServerCallContext context);
  188. Task RunClient(IAsyncStreamReader<global::Grpc.Testing.ClientArgs> requestStream, IServerStreamWriter<global::Grpc.Testing.ClientStatus> responseStream, ServerCallContext context);
  189. Task<global::Grpc.Testing.CoreResponse> CoreCount(global::Grpc.Testing.CoreRequest request, ServerCallContext context);
  190. Task<global::Grpc.Testing.Void> QuitWorker(global::Grpc.Testing.Void request, ServerCallContext context);
  191. }
  192. // server-side abstract class
  193. public abstract class WorkerServiceBase
  194. {
  195. public virtual Task RunServer(IAsyncStreamReader<global::Grpc.Testing.ServerArgs> requestStream, IServerStreamWriter<global::Grpc.Testing.ServerStatus> responseStream, ServerCallContext context)
  196. {
  197. throw new RpcException(new Status(StatusCode.Unimplemented, ""));
  198. }
  199. public virtual Task RunClient(IAsyncStreamReader<global::Grpc.Testing.ClientArgs> requestStream, IServerStreamWriter<global::Grpc.Testing.ClientStatus> responseStream, ServerCallContext context)
  200. {
  201. throw new RpcException(new Status(StatusCode.Unimplemented, ""));
  202. }
  203. public virtual Task<global::Grpc.Testing.CoreResponse> CoreCount(global::Grpc.Testing.CoreRequest request, ServerCallContext context)
  204. {
  205. throw new RpcException(new Status(StatusCode.Unimplemented, ""));
  206. }
  207. public virtual Task<global::Grpc.Testing.Void> QuitWorker(global::Grpc.Testing.Void request, ServerCallContext context)
  208. {
  209. throw new RpcException(new Status(StatusCode.Unimplemented, ""));
  210. }
  211. }
  212. // client stub
  213. public class WorkerServiceClient : ClientBase<WorkerServiceClient>, IWorkerServiceClient
  214. {
  215. public WorkerServiceClient(Channel channel) : base(channel)
  216. {
  217. }
  218. public WorkerServiceClient(CallInvoker callInvoker) : base(callInvoker)
  219. {
  220. }
  221. ///<summary>Protected parameterless constructor to allow creation of test doubles.</summary>
  222. protected WorkerServiceClient() : base()
  223. {
  224. }
  225. ///<summary>Protected constructor to allow creation of configured clients.</summary>
  226. protected WorkerServiceClient(ClientBaseConfiguration configuration) : base(configuration)
  227. {
  228. }
  229. public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus> RunServer(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
  230. {
  231. return RunServer(new CallOptions(headers, deadline, cancellationToken));
  232. }
  233. public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus> RunServer(CallOptions options)
  234. {
  235. return CallInvoker.AsyncDuplexStreamingCall(__Method_RunServer, null, options);
  236. }
  237. public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.ClientArgs, global::Grpc.Testing.ClientStatus> RunClient(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
  238. {
  239. return RunClient(new CallOptions(headers, deadline, cancellationToken));
  240. }
  241. public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.ClientArgs, global::Grpc.Testing.ClientStatus> RunClient(CallOptions options)
  242. {
  243. return CallInvoker.AsyncDuplexStreamingCall(__Method_RunClient, null, options);
  244. }
  245. public virtual global::Grpc.Testing.CoreResponse CoreCount(global::Grpc.Testing.CoreRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
  246. {
  247. return CoreCount(request, new CallOptions(headers, deadline, cancellationToken));
  248. }
  249. public virtual global::Grpc.Testing.CoreResponse CoreCount(global::Grpc.Testing.CoreRequest request, CallOptions options)
  250. {
  251. return CallInvoker.BlockingUnaryCall(__Method_CoreCount, null, options, request);
  252. }
  253. public virtual AsyncUnaryCall<global::Grpc.Testing.CoreResponse> CoreCountAsync(global::Grpc.Testing.CoreRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
  254. {
  255. return CoreCountAsync(request, new CallOptions(headers, deadline, cancellationToken));
  256. }
  257. public virtual AsyncUnaryCall<global::Grpc.Testing.CoreResponse> CoreCountAsync(global::Grpc.Testing.CoreRequest request, CallOptions options)
  258. {
  259. return CallInvoker.AsyncUnaryCall(__Method_CoreCount, null, options, request);
  260. }
  261. public virtual global::Grpc.Testing.Void QuitWorker(global::Grpc.Testing.Void request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
  262. {
  263. return QuitWorker(request, new CallOptions(headers, deadline, cancellationToken));
  264. }
  265. public virtual global::Grpc.Testing.Void QuitWorker(global::Grpc.Testing.Void request, CallOptions options)
  266. {
  267. return CallInvoker.BlockingUnaryCall(__Method_QuitWorker, null, options, request);
  268. }
  269. public virtual AsyncUnaryCall<global::Grpc.Testing.Void> QuitWorkerAsync(global::Grpc.Testing.Void request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
  270. {
  271. return QuitWorkerAsync(request, new CallOptions(headers, deadline, cancellationToken));
  272. }
  273. public virtual AsyncUnaryCall<global::Grpc.Testing.Void> QuitWorkerAsync(global::Grpc.Testing.Void request, CallOptions options)
  274. {
  275. return CallInvoker.AsyncUnaryCall(__Method_QuitWorker, null, options, request);
  276. }
  277. protected override WorkerServiceClient NewInstance(ClientBaseConfiguration configuration)
  278. {
  279. return new WorkerServiceClient(configuration);
  280. }
  281. }
  282. // creates service definition that can be registered with a server
  283. public static ServerServiceDefinition BindService(IWorkerService serviceImpl)
  284. {
  285. return ServerServiceDefinition.CreateBuilder(__ServiceName)
  286. .AddMethod(__Method_RunServer, serviceImpl.RunServer)
  287. .AddMethod(__Method_RunClient, serviceImpl.RunClient)
  288. .AddMethod(__Method_CoreCount, serviceImpl.CoreCount)
  289. .AddMethod(__Method_QuitWorker, serviceImpl.QuitWorker).Build();
  290. }
  291. // creates service definition that can be registered with a server
  292. public static ServerServiceDefinition BindService(WorkerServiceBase serviceImpl)
  293. {
  294. return ServerServiceDefinition.CreateBuilder(__ServiceName)
  295. .AddMethod(__Method_RunServer, serviceImpl.RunServer)
  296. .AddMethod(__Method_RunClient, serviceImpl.RunClient)
  297. .AddMethod(__Method_CoreCount, serviceImpl.CoreCount)
  298. .AddMethod(__Method_QuitWorker, serviceImpl.QuitWorker).Build();
  299. }
  300. // creates a new client
  301. public static WorkerServiceClient NewClient(Channel channel)
  302. {
  303. return new WorkerServiceClient(channel);
  304. }
  305. }
  306. }
  307. #endregion