mirror of https://github.com/grpc/grpc.git
Merge pull request #8857 from jtattermusch/csharp_reflection
Draft of C# server reflectionpull/8907/head
commit
90e46ff7b0
34 changed files with 2911 additions and 29 deletions
@ -0,0 +1,2 @@ |
||||
bin |
||||
obj |
@ -0,0 +1,8 @@ |
||||
{ |
||||
"frameworks": { |
||||
"net45": { } |
||||
}, |
||||
"runtimes": { |
||||
"win": { } |
||||
} |
||||
} |
@ -0,0 +1,59 @@ |
||||
#region Copyright notice and license |
||||
|
||||
// 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. |
||||
|
||||
#endregion |
||||
|
||||
using System; |
||||
using System.Reflection; |
||||
using Grpc.Core; |
||||
using Grpc.Core.Logging; |
||||
using NUnit.Common; |
||||
using NUnitLite; |
||||
|
||||
namespace Grpc.Reflection.Tests |
||||
{ |
||||
/// <summary> |
||||
/// Provides entry point for NUnitLite |
||||
/// </summary> |
||||
public class NUnitMain |
||||
{ |
||||
public static int Main(string[] args) |
||||
{ |
||||
// Make logger immune to NUnit capturing stdout and stderr to workaround https://github.com/nunit/nunit/issues/1406. |
||||
GrpcEnvironment.SetLogger(new TextWriterLogger(Console.Error)); |
||||
#if NETCOREAPP1_0 |
||||
return new AutoRun(typeof(NUnitMain).GetTypeInfo().Assembly).Execute(args, new ExtendedTextWrapper(Console.Out), Console.In); |
||||
#else |
||||
return new AutoRun().Execute(args); |
||||
#endif |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,65 @@ |
||||
{ |
||||
"buildOptions": { |
||||
"emitEntryPoint": true |
||||
}, |
||||
"configurations": { |
||||
"Debug": { |
||||
"buildOptions": { |
||||
"define": [ "SIGNED" ], |
||||
"keyFile": "../keys/Grpc.snk", |
||||
"xmlDoc": true, |
||||
"compile": { |
||||
"includeFiles": [ "../Grpc.Core/Version.cs" ] |
||||
}, |
||||
"copyToOutput": { |
||||
"mappings": { |
||||
"grpc_csharp_ext.x64.dll": "../../../vsprojects/x64/Debug/grpc_csharp_ext.dll", |
||||
"grpc_csharp_ext.x86.dll": "../../../vsprojects/Debug/grpc_csharp_ext.dll", |
||||
"libgrpc_csharp_ext.x64.so": "../../../libs/dbg/libgrpc_csharp_ext.so", |
||||
"libgrpc_csharp_ext.x64.dylib": "../../../libs/dbg/libgrpc_csharp_ext.dylib" |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
"Release": { |
||||
"buildOptions": { |
||||
"define": [ "SIGNED" ], |
||||
"keyFile": "../keys/Grpc.snk", |
||||
"xmlDoc": true, |
||||
"compile": { |
||||
"includeFiles": [ "../Grpc.Core/Version.cs" ] |
||||
}, |
||||
"copyToOutput": { |
||||
"mappings": { |
||||
"grpc_csharp_ext.x64.dll": "../../../vsprojects/x64/Release/grpc_csharp_ext.dll", |
||||
"grpc_csharp_ext.x86.dll": "../../../vsprojects/Release/grpc_csharp_ext.dll", |
||||
"libgrpc_csharp_ext.x64.so": "../../../libs/opt/libgrpc_csharp_ext.so", |
||||
"libgrpc_csharp_ext.x64.dylib": "../../../libs/opt/libgrpc_csharp_ext.dylib" |
||||
} |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
|
||||
"dependencies": { |
||||
"Grpc.Reflection": { |
||||
"target": "project" |
||||
}, |
||||
"NUnit": "3.2.0", |
||||
"NUnitLite": "3.2.0-*" |
||||
}, |
||||
"frameworks": { |
||||
"net45": { }, |
||||
"netcoreapp1.0": { |
||||
"imports": [ |
||||
"portable-net45" |
||||
], |
||||
"dependencies": { |
||||
"Microsoft.NETCore.App": { |
||||
"type": "platform", |
||||
"version": "1.0.0" |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,2 @@ |
||||
bin |
||||
obj |
@ -0,0 +1,28 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<package> |
||||
<metadata> |
||||
<id>Grpc.Reflection</id> |
||||
<title>gRPC C# Reflection</title> |
||||
<summary>Implementation of gRPC reflection service</summary> |
||||
<description>Provides information about services running on a gRPC C# server.</description> |
||||
<version>$version$</version> |
||||
<authors>Google Inc.</authors> |
||||
<owners>grpc-packages</owners> |
||||
<licenseUrl>https://github.com/grpc/grpc/blob/master/LICENSE</licenseUrl> |
||||
<projectUrl>https://github.com/grpc/grpc</projectUrl> |
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance> |
||||
<copyright>Copyright 2016, Google Inc.</copyright> |
||||
<tags>gRPC reflection</tags> |
||||
<dependencies> |
||||
<dependency id="Google.Protobuf" version="$ProtobufVersion$" /> |
||||
<dependency id="Grpc.Core" version="$version$" /> |
||||
<dependency id="System.Interactive.Async" version="3.1.1" /> |
||||
</dependencies> |
||||
</metadata> |
||||
<files> |
||||
<file src="bin/ReleaseSigned/Grpc.Reflection.dll" target="lib/net45" /> |
||||
<file src="bin/ReleaseSigned/Grpc.Reflection.pdb" target="lib/net45" /> |
||||
<file src="bin/ReleaseSigned/Grpc.Reflection.xml" target="lib/net45" /> |
||||
<file src="**\*.cs" target="src" /> |
||||
</files> |
||||
</package> |
@ -0,0 +1,8 @@ |
||||
{ |
||||
"frameworks": { |
||||
"net45": { } |
||||
}, |
||||
"runtimes": { |
||||
"win": { } |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,132 @@ |
||||
// Generated by the protocol buffer compiler. DO NOT EDIT! |
||||
// source: grpc/reflection/v1alpha/reflection.proto |
||||
// Original file comments: |
||||
// 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. |
||||
// |
||||
// Service exported by server reflection |
||||
// |
||||
#region Designer generated code |
||||
|
||||
using System; |
||||
using System.Threading; |
||||
using System.Threading.Tasks; |
||||
using Grpc.Core; |
||||
|
||||
namespace Grpc.Reflection.V1Alpha { |
||||
public static partial class ServerReflection |
||||
{ |
||||
static readonly string __ServiceName = "grpc.reflection.v1alpha.ServerReflection"; |
||||
|
||||
static readonly Marshaller<global::Grpc.Reflection.V1Alpha.ServerReflectionRequest> __Marshaller_ServerReflectionRequest = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Reflection.V1Alpha.ServerReflectionRequest.Parser.ParseFrom); |
||||
static readonly Marshaller<global::Grpc.Reflection.V1Alpha.ServerReflectionResponse> __Marshaller_ServerReflectionResponse = Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Reflection.V1Alpha.ServerReflectionResponse.Parser.ParseFrom); |
||||
|
||||
static readonly Method<global::Grpc.Reflection.V1Alpha.ServerReflectionRequest, global::Grpc.Reflection.V1Alpha.ServerReflectionResponse> __Method_ServerReflectionInfo = new Method<global::Grpc.Reflection.V1Alpha.ServerReflectionRequest, global::Grpc.Reflection.V1Alpha.ServerReflectionResponse>( |
||||
MethodType.DuplexStreaming, |
||||
__ServiceName, |
||||
"ServerReflectionInfo", |
||||
__Marshaller_ServerReflectionRequest, |
||||
__Marshaller_ServerReflectionResponse); |
||||
|
||||
/// <summary>Service descriptor</summary> |
||||
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor |
||||
{ |
||||
get { return global::Grpc.Reflection.V1Alpha.ReflectionReflection.Descriptor.Services[0]; } |
||||
} |
||||
|
||||
/// <summary>Base class for server-side implementations of ServerReflection</summary> |
||||
public abstract partial class ServerReflectionBase |
||||
{ |
||||
/// <summary> |
||||
/// The reflection service is structured as a bidirectional stream, ensuring |
||||
/// all related requests go to a single server. |
||||
/// </summary> |
||||
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, "")); |
||||
} |
||||
|
||||
} |
||||
|
||||
/// <summary>Client for ServerReflection</summary> |
||||
public partial class ServerReflectionClient : ClientBase<ServerReflectionClient> |
||||
{ |
||||
/// <summary>Creates a new client for ServerReflection</summary> |
||||
/// <param name="channel">The channel to use to make remote calls.</param> |
||||
public ServerReflectionClient(Channel channel) : base(channel) |
||||
{ |
||||
} |
||||
/// <summary>Creates a new client for ServerReflection that uses a custom <c>CallInvoker</c>.</summary> |
||||
/// <param name="callInvoker">The callInvoker to use to make remote calls.</param> |
||||
public ServerReflectionClient(CallInvoker callInvoker) : base(callInvoker) |
||||
{ |
||||
} |
||||
/// <summary>Protected parameterless constructor to allow creation of test doubles.</summary> |
||||
protected ServerReflectionClient() : base() |
||||
{ |
||||
} |
||||
/// <summary>Protected constructor to allow creation of configured clients.</summary> |
||||
/// <param name="configuration">The client configuration.</param> |
||||
protected ServerReflectionClient(ClientBaseConfiguration configuration) : base(configuration) |
||||
{ |
||||
} |
||||
|
||||
/// <summary> |
||||
/// The reflection service is structured as a bidirectional stream, ensuring |
||||
/// all related requests go to a single server. |
||||
/// </summary> |
||||
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)); |
||||
} |
||||
/// <summary> |
||||
/// The reflection service is structured as a bidirectional stream, ensuring |
||||
/// all related requests go to a single server. |
||||
/// </summary> |
||||
public virtual AsyncDuplexStreamingCall<global::Grpc.Reflection.V1Alpha.ServerReflectionRequest, global::Grpc.Reflection.V1Alpha.ServerReflectionResponse> ServerReflectionInfo(CallOptions options) |
||||
{ |
||||
return CallInvoker.AsyncDuplexStreamingCall(__Method_ServerReflectionInfo, null, options); |
||||
} |
||||
/// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary> |
||||
protected override ServerReflectionClient NewInstance(ClientBaseConfiguration configuration) |
||||
{ |
||||
return new ServerReflectionClient(configuration); |
||||
} |
||||
} |
||||
|
||||
/// <summary>Creates service definition that can be registered with a server</summary> |
||||
public static ServerServiceDefinition BindService(ServerReflectionBase serviceImpl) |
||||
{ |
||||
return ServerServiceDefinition.CreateBuilder() |
||||
.AddMethod(__Method_ServerReflectionInfo, serviceImpl.ServerReflectionInfo).Build(); |
||||
} |
||||
|
||||
} |
||||
} |
||||
#endregion |
@ -0,0 +1,10 @@ |
||||
<StyleCopSettings Version="105"> |
||||
<SourceFileList> |
||||
<SourceFile>Health.cs</SourceFile> |
||||
<Settings> |
||||
<GlobalSettings> |
||||
<BooleanProperty Name="RulesEnabledByDefault">False</BooleanProperty> |
||||
</GlobalSettings> |
||||
</Settings> |
||||
</SourceFileList> |
||||
</StyleCopSettings> |
@ -0,0 +1,40 @@ |
||||
{ |
||||
"version": "1.1.0-dev", |
||||
"title": "gRPC C# Reflection", |
||||
"authors": [ "Google Inc." ], |
||||
"copyright": "Copyright 2016, Google Inc.", |
||||
"packOptions": { |
||||
"summary": "Implementation of gRPC reflection service", |
||||
"description": "Provides information about services running on a gRPC C# server.", |
||||
"owners": [ "grpc-packages" ], |
||||
"licenseUrl": "https://github.com/grpc/grpc/blob/master/LICENSE", |
||||
"projectUrl": "https://github.com/grpc/grpc", |
||||
"requireLicenseAcceptance": false, |
||||
"tags": [ "gRPC reflection" ] |
||||
}, |
||||
"buildOptions": { |
||||
"define": [ "SIGNED" ], |
||||
"keyFile": "../keys/Grpc.snk", |
||||
"xmlDoc": true, |
||||
"compile": { |
||||
"includeFiles": [ "../Grpc.Core/Version.cs" ] |
||||
} |
||||
}, |
||||
"dependencies": { |
||||
"Grpc.Core": "1.1.0-dev", |
||||
"Google.Protobuf": "3.0.0" |
||||
}, |
||||
"frameworks": { |
||||
"net45": { |
||||
"frameworkAssemblies": { |
||||
"System.Runtime": "", |
||||
"System.IO": "" |
||||
} |
||||
}, |
||||
"netstandard1.5": { |
||||
"dependencies": { |
||||
"NETStandard.Library": "1.6.0" |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,26 @@ |
||||
%YAML 1.2 |
||||
--- | |
||||
{ |
||||
<%include file="../build_options.include" args="executable=True"/> |
||||
"dependencies": { |
||||
"Grpc.Reflection": { |
||||
"target": "project" |
||||
}, |
||||
"NUnit": "3.2.0", |
||||
"NUnitLite": "3.2.0-*" |
||||
}, |
||||
"frameworks": { |
||||
"net45": { }, |
||||
"netcoreapp1.0": { |
||||
"imports": [ |
||||
"portable-net45" |
||||
], |
||||
"dependencies": { |
||||
"Microsoft.NETCore.App": { |
||||
"type": "platform", |
||||
"version": "1.0.0" |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,42 @@ |
||||
%YAML 1.2 |
||||
--- | |
||||
{ |
||||
"version": "${settings.csharp_version}", |
||||
"title": "gRPC C# Reflection", |
||||
"authors": [ "Google Inc." ], |
||||
"copyright": "Copyright 2016, Google Inc.", |
||||
"packOptions": { |
||||
"summary": "Implementation of gRPC reflection service", |
||||
"description": "Provides information about services running on a gRPC C# server.", |
||||
"owners": [ "grpc-packages" ], |
||||
"licenseUrl": "https://github.com/grpc/grpc/blob/master/LICENSE", |
||||
"projectUrl": "https://github.com/grpc/grpc", |
||||
"requireLicenseAcceptance": false, |
||||
"tags": [ "gRPC reflection" ] |
||||
}, |
||||
"buildOptions": { |
||||
"define": [ "SIGNED" ], |
||||
"keyFile": "../keys/Grpc.snk", |
||||
"xmlDoc": true, |
||||
"compile": { |
||||
"includeFiles": [ "../Grpc.Core/Version.cs" ] |
||||
} |
||||
}, |
||||
"dependencies": { |
||||
"Grpc.Core": "${settings.csharp_version}", |
||||
"Google.Protobuf": "3.0.0" |
||||
}, |
||||
"frameworks": { |
||||
"net45": { |
||||
"frameworkAssemblies": { |
||||
"System.Runtime": "", |
||||
"System.IO": "" |
||||
} |
||||
}, |
||||
"netstandard1.5": { |
||||
"dependencies": { |
||||
"NETStandard.Library": "1.6.0" |
||||
} |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue