Index: third_party/grpc/src/csharp/Grpc.Core/Internal/ServerCalls.cs |
diff --git a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/PackageDescriptor.cs b/third_party/grpc/src/csharp/Grpc.Core/Internal/ServerCalls.cs |
similarity index 51% |
copy from third_party/protobuf/csharp/src/Google.Protobuf/Reflection/PackageDescriptor.cs |
copy to third_party/grpc/src/csharp/Grpc.Core/Internal/ServerCalls.cs |
index e547d834986de8d80703504469e9c39b3d8ae93d..81279678b95699c7f0f8aa48ad517d83b3faa0e8 100644 |
--- a/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/PackageDescriptor.cs |
+++ b/third_party/grpc/src/csharp/Grpc.Core/Internal/ServerCalls.cs |
@@ -1,7 +1,7 @@ |
#region Copyright notice and license |
-// Protocol Buffers - Google's data interchange format |
-// Copyright 2008 Google Inc. All rights reserved. |
-// https://developers.google.com/protocol-buffers/ |
+ |
+// 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 |
@@ -28,41 +28,44 @@ |
// 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. |
+ |
#endregion |
-namespace Google.Protobuf.Reflection |
+using System; |
+using System.Threading; |
+using System.Threading.Tasks; |
+using Grpc.Core; |
+ |
+namespace Grpc.Core.Internal |
{ |
- /// <summary> |
- /// Represents a package in the symbol table. We use PackageDescriptors |
- /// just as placeholders so that someone cannot define, say, a message type |
- /// that has the same name as an existing package. |
- /// </summary> |
- internal sealed class PackageDescriptor : IDescriptor |
+ internal static class ServerCalls |
{ |
- private readonly string name; |
- private readonly string fullName; |
- private readonly FileDescriptor file; |
- |
- internal PackageDescriptor(string name, string fullName, FileDescriptor file) |
+ public static IServerCallHandler UnaryCall<TRequest, TResponse>(Method<TRequest, TResponse> method, UnaryServerMethod<TRequest, TResponse> handler) |
+ where TRequest : class |
+ where TResponse : class |
{ |
- this.file = file; |
- this.fullName = fullName; |
- this.name = name; |
+ return new UnaryServerCallHandler<TRequest, TResponse>(method, handler); |
} |
- public string Name |
+ public static IServerCallHandler ClientStreamingCall<TRequest, TResponse>(Method<TRequest, TResponse> method, ClientStreamingServerMethod<TRequest, TResponse> handler) |
+ where TRequest : class |
+ where TResponse : class |
{ |
- get { return name; } |
+ return new ClientStreamingServerCallHandler<TRequest, TResponse>(method, handler); |
} |
- public string FullName |
+ public static IServerCallHandler ServerStreamingCall<TRequest, TResponse>(Method<TRequest, TResponse> method, ServerStreamingServerMethod<TRequest, TResponse> handler) |
+ where TRequest : class |
+ where TResponse : class |
{ |
- get { return fullName; } |
+ return new ServerStreamingServerCallHandler<TRequest, TResponse>(method, handler); |
} |
- public FileDescriptor File |
+ public static IServerCallHandler DuplexStreamingCall<TRequest, TResponse>(Method<TRequest, TResponse> method, DuplexStreamingServerMethod<TRequest, TResponse> handler) |
+ where TRequest : class |
+ where TResponse : class |
{ |
- get { return file; } |
+ return new DuplexStreamingServerCallHandler<TRequest, TResponse>(method, handler); |
} |
} |
-} |
+} |