Merge pull request #1028 from murgatroid99/node_install_instructions_formatting
Improved node install instructions and bumped version
diff --git a/src/csharp/Grpc.Core/Calls.cs b/src/csharp/Grpc.Core/Calls.cs
index 5409ce3..cc1d67a 100644
--- a/src/csharp/Grpc.Core/Calls.cs
+++ b/src/csharp/Grpc.Core/Calls.cs
@@ -38,8 +38,6 @@
namespace Grpc.Core
{
- // NOTE: this class is work-in-progress
-
/// <summary>
/// Helper methods for generated stubs to make RPC calls.
/// </summary>
diff --git a/src/csharp/Grpc.Core/Channel.cs b/src/csharp/Grpc.Core/Channel.cs
index 5a47961..3a42dac 100644
--- a/src/csharp/Grpc.Core/Channel.cs
+++ b/src/csharp/Grpc.Core/Channel.cs
@@ -36,6 +36,9 @@
namespace Grpc.Core
{
+ /// <summary>
+ /// gRPC Channel
+ /// </summary>
public class Channel : IDisposable
{
readonly ChannelSafeHandle handle;
diff --git a/src/csharp/Grpc.Core/ChannelArgs.cs b/src/csharp/Grpc.Core/ChannelArgs.cs
index 2d560c0..74ab310 100644
--- a/src/csharp/Grpc.Core/ChannelArgs.cs
+++ b/src/csharp/Grpc.Core/ChannelArgs.cs
@@ -30,6 +30,7 @@
#endregion
using System;
using System.Collections.Generic;
+using System.Collections.Immutable;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
@@ -37,33 +38,18 @@
namespace Grpc.Core
{
- // TODO: should we be using the builder pattern?
+ /// <summary>
+ /// gRPC channel options.
+ /// </summary>
public class ChannelArgs
{
public const string SslTargetNameOverrideKey = "grpc.ssl_target_name_override";
- public class Builder
+ readonly ImmutableDictionary<string, string> stringArgs;
+
+ private ChannelArgs(ImmutableDictionary<string, string> stringArgs)
{
- Dictionary<string, string> stringArgs = new Dictionary<string, string>();
- // TODO: AddInteger not supported yet.
- public Builder AddString(string key, string value)
- {
- stringArgs.Add(key, value);
- return this;
- }
-
- public ChannelArgs Build()
- {
- return new ChannelArgs(stringArgs);
- }
- }
-
- Dictionary<string, string> stringArgs;
-
- private ChannelArgs(Dictionary<string, string> stringArgs)
- {
- // TODO: use immutable dict?
- this.stringArgs = new Dictionary<string, string>(stringArgs);
+ this.stringArgs = stringArgs;
}
public string GetSslTargetNameOverride()
@@ -76,11 +62,28 @@
return null;
}
- public static Builder NewBuilder()
+ public static Builder CreateBuilder()
{
return new Builder();
}
+ public class Builder
+ {
+ readonly Dictionary<string, string> stringArgs = new Dictionary<string, string>();
+
+ // TODO: AddInteger not supported yet.
+ public Builder AddString(string key, string value)
+ {
+ stringArgs.Add(key, value);
+ return this;
+ }
+
+ public ChannelArgs Build()
+ {
+ return new ChannelArgs(stringArgs.ToImmutableDictionary());
+ }
+ }
+
/// <summary>
/// Creates native object for the channel arguments.
/// </summary>
diff --git a/src/csharp/Grpc.Core/Credentials.cs b/src/csharp/Grpc.Core/Credentials.cs
index ddf9d6d..15dd3ef 100644
--- a/src/csharp/Grpc.Core/Credentials.cs
+++ b/src/csharp/Grpc.Core/Credentials.cs
@@ -36,6 +36,9 @@
namespace Grpc.Core
{
+ /// <summary>
+ /// Client-side credentials.
+ /// </summary>
public abstract class Credentials
{
/// <summary>
diff --git a/src/csharp/Grpc.Core/Grpc.Core.csproj b/src/csharp/Grpc.Core/Grpc.Core.csproj
index c4b12b1..29f1a06 100644
--- a/src/csharp/Grpc.Core/Grpc.Core.csproj
+++ b/src/csharp/Grpc.Core/Grpc.Core.csproj
@@ -31,6 +31,9 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
+ <Reference Include="System.Collections.Immutable">
+ <HintPath>..\packages\System.Collections.Immutable.1.1.34-rc\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
+ </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Internal\GrpcLog.cs" />
@@ -54,7 +57,7 @@
<Compile Include="Internal\ServerSafeHandle.cs" />
<Compile Include="Method.cs" />
<Compile Include="ServerCalls.cs" />
- <Compile Include="ServerCallHandler.cs" />
+ <Compile Include="Internal\ServerCallHandler.cs" />
<Compile Include="Marshaller.cs" />
<Compile Include="ServerServiceDefinition.cs" />
<Compile Include="Utils\RecordingObserver.cs" />
@@ -77,6 +80,9 @@
<Compile Include="Internal\ServerCredentialsSafeHandle.cs" />
<Compile Include="ServerCredentials.cs" />
</ItemGroup>
+ <ItemGroup>
+ <None Include="packages.config" />
+ </ItemGroup>
<Choose>
<!-- Under older versions of Monodevelop, Choose is not supported and is just
ignored, which gives us the desired effect. -->
diff --git a/src/csharp/Grpc.Core/ServerCallHandler.cs b/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs
similarity index 99%
rename from src/csharp/Grpc.Core/ServerCallHandler.cs
rename to src/csharp/Grpc.Core/Internal/ServerCallHandler.cs
index c5598e5..25fd4fa 100644
--- a/src/csharp/Grpc.Core/ServerCallHandler.cs
+++ b/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs
@@ -36,7 +36,7 @@
using Grpc.Core.Internal;
using Grpc.Core.Utils;
-namespace Grpc.Core
+namespace Grpc.Core.Internal
{
internal interface IServerCallHandler
{
diff --git a/src/csharp/Grpc.Core/Marshaller.cs b/src/csharp/Grpc.Core/Marshaller.cs
index 9c9dfa4..e73e7b7 100644
--- a/src/csharp/Grpc.Core/Marshaller.cs
+++ b/src/csharp/Grpc.Core/Marshaller.cs
@@ -66,6 +66,9 @@
}
}
+ /// <summary>
+ /// Utilities for creating marshallers.
+ /// </summary>
public static class Marshallers
{
public static Marshaller<T> Create<T>(Func<T, byte[]> serializer, Func<byte[], T> deserializer)
diff --git a/src/csharp/Grpc.Core/RpcException.cs b/src/csharp/Grpc.Core/RpcException.cs
index 0356bf7..433d872 100644
--- a/src/csharp/Grpc.Core/RpcException.cs
+++ b/src/csharp/Grpc.Core/RpcException.cs
@@ -35,6 +35,9 @@
namespace Grpc.Core
{
+ /// <summary>
+ /// Thrown when remote procedure call fails.
+ /// </summary>
public class RpcException : Exception
{
private readonly Status status;
diff --git a/src/csharp/Grpc.Core/ServerCalls.cs b/src/csharp/Grpc.Core/ServerCalls.cs
index b2dcdf2..dcae994 100644
--- a/src/csharp/Grpc.Core/ServerCalls.cs
+++ b/src/csharp/Grpc.Core/ServerCalls.cs
@@ -32,6 +32,7 @@
#endregion
using System;
+using Grpc.Core.Internal;
namespace Grpc.Core
{
diff --git a/src/csharp/Grpc.Core/ServerCredentials.cs b/src/csharp/Grpc.Core/ServerCredentials.cs
index 59c341e..ab7d0b4 100644
--- a/src/csharp/Grpc.Core/ServerCredentials.cs
+++ b/src/csharp/Grpc.Core/ServerCredentials.cs
@@ -33,10 +33,14 @@
using System;
using System.Collections.Generic;
+using System.Collections.Immutable;
using Grpc.Core.Internal;
namespace Grpc.Core
{
+ /// <summary>
+ /// Server side credentials.
+ /// </summary>
public abstract class ServerCredentials
{
/// <summary>
@@ -51,8 +55,8 @@
/// </summary>
public class KeyCertificatePair
{
- string certChain;
- string privateKey;
+ readonly string certChain;
+ readonly string privateKey;
public KeyCertificatePair(string certChain, string privateKey)
{
@@ -82,10 +86,9 @@
/// </summary>
public class SslServerCredentials : ServerCredentials
{
- // TODO: immutable list...
- List<KeyCertificatePair> keyCertPairs;
+ ImmutableList<KeyCertificatePair> keyCertPairs;
- public SslServerCredentials(List<KeyCertificatePair> keyCertPairs)
+ public SslServerCredentials(ImmutableList<KeyCertificatePair> keyCertPairs)
{
this.keyCertPairs = keyCertPairs;
}
diff --git a/src/csharp/Grpc.Core/ServerServiceDefinition.cs b/src/csharp/Grpc.Core/ServerServiceDefinition.cs
index d7f69f3..0044154 100644
--- a/src/csharp/Grpc.Core/ServerServiceDefinition.cs
+++ b/src/csharp/Grpc.Core/ServerServiceDefinition.cs
@@ -33,22 +33,26 @@
using System;
using System.Collections.Generic;
+using System.Collections.Immutable;
+using Grpc.Core.Internal;
namespace Grpc.Core
{
+ /// <summary>
+ /// Mapping of method names to server call handlers.
+ /// </summary>
public class ServerServiceDefinition
{
readonly string serviceName;
- // TODO: we would need an immutable dictionary here...
- readonly Dictionary<string, IServerCallHandler> callHandlers;
+ readonly ImmutableDictionary<string, IServerCallHandler> callHandlers;
- private ServerServiceDefinition(string serviceName, Dictionary<string, IServerCallHandler> callHandlers)
+ private ServerServiceDefinition(string serviceName, ImmutableDictionary<string, IServerCallHandler> callHandlers)
{
this.serviceName = serviceName;
- this.callHandlers = new Dictionary<string, IServerCallHandler>(callHandlers);
+ this.callHandlers = callHandlers;
}
- internal Dictionary<string, IServerCallHandler> CallHandlers
+ internal ImmutableDictionary<string, IServerCallHandler> CallHandlers
{
get
{
@@ -89,7 +93,7 @@
public ServerServiceDefinition Build()
{
- return new ServerServiceDefinition(serviceName, callHandlers);
+ return new ServerServiceDefinition(serviceName, callHandlers.ToImmutableDictionary());
}
}
}
diff --git a/src/csharp/Grpc.Core/StatusCode.cs b/src/csharp/Grpc.Core/StatusCode.cs
index 111863a..a9696fa 100644
--- a/src/csharp/Grpc.Core/StatusCode.cs
+++ b/src/csharp/Grpc.Core/StatusCode.cs
@@ -35,9 +35,9 @@
namespace Grpc.Core
{
- // TODO: element names should changed to comply with C# naming conventions.
/// <summary>
- /// based on grpc_status_code from grpc/status.h
+ /// Result of a remote procedure call.
+ /// Based on grpc_status_code from grpc/status.h
/// </summary>
public enum StatusCode
{
diff --git a/src/csharp/Grpc.Core/packages.config b/src/csharp/Grpc.Core/packages.config
new file mode 100644
index 0000000..cf711ac
--- /dev/null
+++ b/src/csharp/Grpc.Core/packages.config
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="System.Collections.Immutable" version="1.1.34-rc" targetFramework="net45" />
+</packages>
\ No newline at end of file
diff --git a/src/csharp/Grpc.Examples/MathGrpc.cs b/src/csharp/Grpc.Examples/MathGrpc.cs
index f938a24..33a9ca9 100644
--- a/src/csharp/Grpc.Examples/MathGrpc.cs
+++ b/src/csharp/Grpc.Examples/MathGrpc.cs
@@ -45,35 +45,34 @@
/// </summary>
public class MathGrpc
{
- readonly static Marshaller<DivArgs> divArgsMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), DivArgs.ParseFrom);
- readonly static Marshaller<DivReply> divReplyMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), DivReply.ParseFrom);
- readonly static Marshaller<Num> numMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), Num.ParseFrom);
- readonly static Marshaller<FibArgs> fibArgsMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), FibArgs.ParseFrom);
+ static readonly Marshaller<DivArgs> DivArgsMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), DivArgs.ParseFrom);
+ static readonly Marshaller<DivReply> DivReplyMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), DivReply.ParseFrom);
+ static readonly Marshaller<Num> NumMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), Num.ParseFrom);
+ static readonly Marshaller<FibArgs> FibArgsMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), FibArgs.ParseFrom);
- readonly static Method<DivArgs, DivReply> divMethod = new Method<DivArgs, DivReply>(
+ static readonly Method<DivArgs, DivReply> DivMethod = new Method<DivArgs, DivReply>(
MethodType.Unary,
"/math.Math/Div",
- divArgsMarshaller,
- divReplyMarshaller
- );
- readonly static Method<FibArgs, Num> fibMethod = new Method<FibArgs, Num>(
+ DivArgsMarshaller,
+ DivReplyMarshaller);
+
+ static readonly Method<FibArgs, Num> FibMethod = new Method<FibArgs, Num>(
MethodType.ServerStreaming,
"/math.Math/Fib",
- fibArgsMarshaller,
- numMarshaller
- );
- readonly static Method<Num, Num> sumMethod = new Method<Num, Num>(
+ FibArgsMarshaller,
+ NumMarshaller);
+
+ static readonly Method<Num, Num> SumMethod = new Method<Num, Num>(
MethodType.ClientStreaming,
"/math.Math/Sum",
- numMarshaller,
- numMarshaller
- );
- readonly static Method<DivArgs, DivReply> divManyMethod = new Method<DivArgs, DivReply>(
+ NumMarshaller,
+ NumMarshaller);
+
+ static readonly Method<DivArgs, DivReply> DivManyMethod = new Method<DivArgs, DivReply>(
MethodType.DuplexStreaming,
"/math.Math/DivMany",
- divArgsMarshaller,
- divReplyMarshaller
- );
+ DivArgsMarshaller,
+ DivReplyMarshaller);
public interface IMathServiceClient
{
@@ -99,31 +98,31 @@
public DivReply Div(DivArgs request, CancellationToken token = default(CancellationToken))
{
- var call = new Grpc.Core.Call<DivArgs, DivReply>(divMethod, channel);
+ var call = new Grpc.Core.Call<DivArgs, DivReply>(DivMethod, channel);
return Calls.BlockingUnaryCall(call, request, token);
}
public Task<DivReply> DivAsync(DivArgs request, CancellationToken token = default(CancellationToken))
{
- var call = new Grpc.Core.Call<DivArgs, DivReply>(divMethod, channel);
+ var call = new Grpc.Core.Call<DivArgs, DivReply>(DivMethod, channel);
return Calls.AsyncUnaryCall(call, request, token);
}
public void Fib(FibArgs request, IObserver<Num> responseObserver, CancellationToken token = default(CancellationToken))
{
- var call = new Grpc.Core.Call<FibArgs, Num>(fibMethod, channel);
+ var call = new Grpc.Core.Call<FibArgs, Num>(FibMethod, channel);
Calls.AsyncServerStreamingCall(call, request, responseObserver, token);
}
public ClientStreamingAsyncResult<Num, Num> Sum(CancellationToken token = default(CancellationToken))
{
- var call = new Grpc.Core.Call<Num, Num>(sumMethod, channel);
+ var call = new Grpc.Core.Call<Num, Num>(SumMethod, channel);
return Calls.AsyncClientStreamingCall(call, token);
}
public IObserver<DivArgs> DivMany(IObserver<DivReply> responseObserver, CancellationToken token = default(CancellationToken))
{
- var call = new Grpc.Core.Call<DivArgs, DivReply>(divManyMethod, channel);
+ var call = new Grpc.Core.Call<DivArgs, DivReply>(DivManyMethod, channel);
return Calls.DuplexStreamingCall(call, responseObserver, token);
}
}
@@ -143,10 +142,10 @@
public static ServerServiceDefinition BindService(IMathService serviceImpl)
{
return ServerServiceDefinition.CreateBuilder("/math.Math/")
- .AddMethod(divMethod, serviceImpl.Div)
- .AddMethod(fibMethod, serviceImpl.Fib)
- .AddMethod(sumMethod, serviceImpl.Sum)
- .AddMethod(divManyMethod, serviceImpl.DivMany).Build();
+ .AddMethod(DivMethod, serviceImpl.Div)
+ .AddMethod(FibMethod, serviceImpl.Fib)
+ .AddMethod(SumMethod, serviceImpl.Sum)
+ .AddMethod(DivManyMethod, serviceImpl.DivMany).Build();
}
public static IMathServiceClient NewStub(Channel channel)
diff --git a/src/csharp/Grpc.Examples/Settings.StyleCop b/src/csharp/Grpc.Examples/Settings.StyleCop
new file mode 100644
index 0000000..e9b6e71
--- /dev/null
+++ b/src/csharp/Grpc.Examples/Settings.StyleCop
@@ -0,0 +1,10 @@
+<StyleCopSettings Version="105">
+ <SourceFileList>
+ <SourceFile>Math.cs</SourceFile>
+ <Settings>
+ <GlobalSettings>
+ <BooleanProperty Name="RulesEnabledByDefault">False</BooleanProperty>
+ </GlobalSettings>
+ </Settings>
+ </SourceFileList>
+</StyleCopSettings>
\ No newline at end of file
diff --git a/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj b/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj
index 438bf9e..cfb2587 100644
--- a/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj
+++ b/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj
@@ -39,6 +39,10 @@
<Reference Include="Google.ProtocolBuffers">
<HintPath>..\packages\Google.ProtocolBuffers.2.4.1.521\lib\net40\Google.ProtocolBuffers.dll</HintPath>
</Reference>
+ <Reference Include="System.Collections.Immutable, Version=1.1.34.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\packages\System.Collections.Immutable.1.1.34-rc\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
+ </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -76,8 +80,5 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
- <ItemGroup>
- <Folder Include="proto\" />
- <Folder Include="data\" />
- </ItemGroup>
-</Project>
+ <ItemGroup />
+</Project>
\ No newline at end of file
diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs
index 56760ec..6b92d3c 100644
--- a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs
+++ b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs
@@ -109,7 +109,7 @@
ChannelArgs channelArgs = null;
if (!string.IsNullOrEmpty(options.serverHostOverride))
{
- channelArgs = ChannelArgs.NewBuilder()
+ channelArgs = ChannelArgs.CreateBuilder()
.AddString(ChannelArgs.SslTargetNameOverrideKey, options.serverHostOverride).Build();
}
diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs b/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs
index 36c784e..814f631 100644
--- a/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs
+++ b/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs
@@ -62,7 +62,7 @@
int port = server.AddPort(host + ":0", TestCredentials.CreateTestServerCredentials());
server.Start();
- var channelArgs = ChannelArgs.NewBuilder()
+ var channelArgs = ChannelArgs.CreateBuilder()
.AddString(ChannelArgs.SslTargetNameOverrideKey, TestCredentials.DefaultHostOverride).Build();
channel = new Channel(host + ":" + port, TestCredentials.CreateTestClientCredentials(true), channelArgs);
diff --git a/src/csharp/Grpc.IntegrationTesting/Settings.StyleCop b/src/csharp/Grpc.IntegrationTesting/Settings.StyleCop
new file mode 100644
index 0000000..fb99cd4
--- /dev/null
+++ b/src/csharp/Grpc.IntegrationTesting/Settings.StyleCop
@@ -0,0 +1,11 @@
+<StyleCopSettings Version="105">
+ <SourceFileList>
+ <SourceFile>Messages.cs</SourceFile>
+ <SourceFile>Empty.cs</SourceFile>
+ <Settings>
+ <GlobalSettings>
+ <BooleanProperty Name="RulesEnabledByDefault">False</BooleanProperty>
+ </GlobalSettings>
+ </Settings>
+ </SourceFileList>
+</StyleCopSettings>
\ No newline at end of file
diff --git a/src/csharp/Grpc.IntegrationTesting/TestCredentials.cs b/src/csharp/Grpc.IntegrationTesting/TestCredentials.cs
index 10df704..401c50b 100644
--- a/src/csharp/Grpc.IntegrationTesting/TestCredentials.cs
+++ b/src/csharp/Grpc.IntegrationTesting/TestCredentials.cs
@@ -33,6 +33,7 @@
using System;
using System.Collections.Generic;
+using System.Collections.Immutable;
using System.Diagnostics;
using System.IO;
using System.Text.RegularExpressions;
@@ -77,7 +78,7 @@
var keyCertPair = new KeyCertificatePair(
File.ReadAllText(ServerCertChainPath),
File.ReadAllText(ServerPrivateKeyPath));
- return new SslServerCredentials(new List<KeyCertificatePair> { keyCertPair });
+ return new SslServerCredentials(ImmutableList.Create(keyCertPair));
}
}
}
diff --git a/src/csharp/Grpc.IntegrationTesting/TestServiceGrpc.cs b/src/csharp/Grpc.IntegrationTesting/TestServiceGrpc.cs
index b71704b..9b0251c 100644
--- a/src/csharp/Grpc.IntegrationTesting/TestServiceGrpc.cs
+++ b/src/csharp/Grpc.IntegrationTesting/TestServiceGrpc.cs
@@ -44,50 +44,49 @@
/// </summary>
public class TestServiceGrpc
{
- readonly static Marshaller<Empty> emptyMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), Empty.ParseFrom);
- readonly static Marshaller<SimpleRequest> simpleRequestMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), SimpleRequest.ParseFrom);
- readonly static Marshaller<SimpleResponse> simpleResponseMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), SimpleResponse.ParseFrom);
- readonly static Marshaller<StreamingOutputCallRequest> streamingOutputCallRequestMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), StreamingOutputCallRequest.ParseFrom);
- readonly static Marshaller<StreamingOutputCallResponse> streamingOutputCallResponseMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), StreamingOutputCallResponse.ParseFrom);
- readonly static Marshaller<StreamingInputCallRequest> streamingInputCallRequestMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), StreamingInputCallRequest.ParseFrom);
- readonly static Marshaller<StreamingInputCallResponse> streamingInputCallResponseMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), StreamingInputCallResponse.ParseFrom);
+ static readonly Marshaller<Empty> EmptyMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), Empty.ParseFrom);
+ static readonly Marshaller<SimpleRequest> SimpleRequestMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), SimpleRequest.ParseFrom);
+ static readonly Marshaller<SimpleResponse> SimpleResponseMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), SimpleResponse.ParseFrom);
+ static readonly Marshaller<StreamingOutputCallRequest> StreamingOutputCallRequestMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), StreamingOutputCallRequest.ParseFrom);
+ static readonly Marshaller<StreamingOutputCallResponse> StreamingOutputCallResponseMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), StreamingOutputCallResponse.ParseFrom);
+ static readonly Marshaller<StreamingInputCallRequest> StreamingInputCallRequestMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), StreamingInputCallRequest.ParseFrom);
+ static readonly Marshaller<StreamingInputCallResponse> StreamingInputCallResponseMarshaller = Marshallers.Create((arg) => arg.ToByteArray(), StreamingInputCallResponse.ParseFrom);
- readonly static Method<Empty, Empty> emptyCallMethod = new Method<Empty, Empty>(
+ static readonly Method<Empty, Empty> EmptyCallMethod = new Method<Empty, Empty>(
MethodType.Unary,
"/grpc.testing.TestService/EmptyCall",
- emptyMarshaller,
- emptyMarshaller
- );
- readonly static Method<SimpleRequest, SimpleResponse> unaryCallMethod = new Method<SimpleRequest, SimpleResponse>(
+ EmptyMarshaller,
+ EmptyMarshaller);
+
+ static readonly Method<SimpleRequest, SimpleResponse> UnaryCallMethod = new Method<SimpleRequest, SimpleResponse>(
MethodType.Unary,
"/grpc.testing.TestService/UnaryCall",
- simpleRequestMarshaller,
- simpleResponseMarshaller
- );
- readonly static Method<StreamingOutputCallRequest, StreamingOutputCallResponse> streamingOutputCallMethod = new Method<StreamingOutputCallRequest, StreamingOutputCallResponse>(
+ SimpleRequestMarshaller,
+ SimpleResponseMarshaller);
+
+ static readonly Method<StreamingOutputCallRequest, StreamingOutputCallResponse> StreamingOutputCallMethod = new Method<StreamingOutputCallRequest, StreamingOutputCallResponse>(
MethodType.ServerStreaming,
"/grpc.testing.TestService/StreamingOutputCall",
- streamingOutputCallRequestMarshaller,
- streamingOutputCallResponseMarshaller
- );
- readonly static Method<StreamingInputCallRequest, StreamingInputCallResponse> streamingInputCallMethod = new Method<StreamingInputCallRequest, StreamingInputCallResponse>(
+ StreamingOutputCallRequestMarshaller,
+ StreamingOutputCallResponseMarshaller);
+
+ static readonly Method<StreamingInputCallRequest, StreamingInputCallResponse> StreamingInputCallMethod = new Method<StreamingInputCallRequest, StreamingInputCallResponse>(
MethodType.ClientStreaming,
"/grpc.testing.TestService/StreamingInputCall",
- streamingInputCallRequestMarshaller,
- streamingInputCallResponseMarshaller
- );
- readonly static Method<StreamingOutputCallRequest, StreamingOutputCallResponse> fullDuplexCallMethod = new Method<StreamingOutputCallRequest, StreamingOutputCallResponse>(
+ StreamingInputCallRequestMarshaller,
+ StreamingInputCallResponseMarshaller);
+
+ static readonly Method<StreamingOutputCallRequest, StreamingOutputCallResponse> FullDuplexCallMethod = new Method<StreamingOutputCallRequest, StreamingOutputCallResponse>(
MethodType.DuplexStreaming,
"/grpc.testing.TestService/FullDuplexCall",
- streamingOutputCallRequestMarshaller,
- streamingOutputCallResponseMarshaller
- );
- readonly static Method<StreamingOutputCallRequest, StreamingOutputCallResponse> halfDuplexCallMethod = new Method<StreamingOutputCallRequest, StreamingOutputCallResponse>(
+ StreamingOutputCallRequestMarshaller,
+ StreamingOutputCallResponseMarshaller);
+
+ static readonly Method<StreamingOutputCallRequest, StreamingOutputCallResponse> HalfDuplexCallMethod = new Method<StreamingOutputCallRequest, StreamingOutputCallResponse>(
MethodType.DuplexStreaming,
"/grpc.testing.TestService/HalfDuplexCall",
- streamingOutputCallRequestMarshaller,
- streamingOutputCallResponseMarshaller
- );
+ StreamingOutputCallRequestMarshaller,
+ StreamingOutputCallResponseMarshaller);
public interface ITestServiceClient
{
@@ -119,49 +118,49 @@
public Empty EmptyCall(Empty request, CancellationToken token = default(CancellationToken))
{
- var call = new Grpc.Core.Call<Empty, Empty>(emptyCallMethod, channel);
+ var call = new Grpc.Core.Call<Empty, Empty>(EmptyCallMethod, channel);
return Calls.BlockingUnaryCall(call, request, token);
}
public Task<Empty> EmptyCallAsync(Empty request, CancellationToken token = default(CancellationToken))
{
- var call = new Grpc.Core.Call<Empty, Empty>(emptyCallMethod, channel);
+ var call = new Grpc.Core.Call<Empty, Empty>(EmptyCallMethod, channel);
return Calls.AsyncUnaryCall(call, request, token);
}
public SimpleResponse UnaryCall(SimpleRequest request, CancellationToken token = default(CancellationToken))
{
- var call = new Grpc.Core.Call<SimpleRequest, SimpleResponse>(unaryCallMethod, channel);
+ var call = new Grpc.Core.Call<SimpleRequest, SimpleResponse>(UnaryCallMethod, channel);
return Calls.BlockingUnaryCall(call, request, token);
}
public Task<SimpleResponse> UnaryCallAsync(SimpleRequest request, CancellationToken token = default(CancellationToken))
{
- var call = new Grpc.Core.Call<SimpleRequest, SimpleResponse>(unaryCallMethod, channel);
+ var call = new Grpc.Core.Call<SimpleRequest, SimpleResponse>(UnaryCallMethod, channel);
return Calls.AsyncUnaryCall(call, request, token);
}
- public void StreamingOutputCall(StreamingOutputCallRequest request, IObserver<StreamingOutputCallResponse> responseObserver, CancellationToken token = default(CancellationToken)) {
- var call = new Grpc.Core.Call<StreamingOutputCallRequest, StreamingOutputCallResponse>(streamingOutputCallMethod, channel);
+ public void StreamingOutputCall(StreamingOutputCallRequest request, IObserver<StreamingOutputCallResponse> responseObserver, CancellationToken token = default(CancellationToken))
+ {
+ var call = new Grpc.Core.Call<StreamingOutputCallRequest, StreamingOutputCallResponse>(StreamingOutputCallMethod, channel);
Calls.AsyncServerStreamingCall(call, request, responseObserver, token);
}
public ClientStreamingAsyncResult<StreamingInputCallRequest, StreamingInputCallResponse> StreamingInputCall(CancellationToken token = default(CancellationToken))
{
- var call = new Grpc.Core.Call<StreamingInputCallRequest, StreamingInputCallResponse>(streamingInputCallMethod, channel);
+ var call = new Grpc.Core.Call<StreamingInputCallRequest, StreamingInputCallResponse>(StreamingInputCallMethod, channel);
return Calls.AsyncClientStreamingCall(call, token);
}
public IObserver<StreamingOutputCallRequest> FullDuplexCall(IObserver<StreamingOutputCallResponse> responseObserver, CancellationToken token = default(CancellationToken))
{
- var call = new Grpc.Core.Call<StreamingOutputCallRequest, StreamingOutputCallResponse>(fullDuplexCallMethod, channel);
+ var call = new Grpc.Core.Call<StreamingOutputCallRequest, StreamingOutputCallResponse>(FullDuplexCallMethod, channel);
return Calls.DuplexStreamingCall(call, responseObserver, token);
}
-
public IObserver<StreamingOutputCallRequest> HalfDuplexCall(IObserver<StreamingOutputCallResponse> responseObserver, CancellationToken token = default(CancellationToken))
{
- var call = new Grpc.Core.Call<StreamingOutputCallRequest, StreamingOutputCallResponse>(halfDuplexCallMethod, channel);
+ var call = new Grpc.Core.Call<StreamingOutputCallRequest, StreamingOutputCallResponse>(HalfDuplexCallMethod, channel);
return Calls.DuplexStreamingCall(call, responseObserver, token);
}
}
@@ -185,12 +184,12 @@
public static ServerServiceDefinition BindService(ITestService serviceImpl)
{
return ServerServiceDefinition.CreateBuilder("/grpc.testing.TestService/")
- .AddMethod(emptyCallMethod, serviceImpl.EmptyCall)
- .AddMethod(unaryCallMethod, serviceImpl.UnaryCall)
- .AddMethod(streamingOutputCallMethod, serviceImpl.StreamingOutputCall)
- .AddMethod(streamingInputCallMethod, serviceImpl.StreamingInputCall)
- .AddMethod(fullDuplexCallMethod, serviceImpl.FullDuplexCall)
- .AddMethod(halfDuplexCallMethod, serviceImpl.HalfDuplexCall)
+ .AddMethod(EmptyCallMethod, serviceImpl.EmptyCall)
+ .AddMethod(UnaryCallMethod, serviceImpl.UnaryCall)
+ .AddMethod(StreamingOutputCallMethod, serviceImpl.StreamingOutputCall)
+ .AddMethod(StreamingInputCallMethod, serviceImpl.StreamingInputCall)
+ .AddMethod(FullDuplexCallMethod, serviceImpl.FullDuplexCall)
+ .AddMethod(HalfDuplexCallMethod, serviceImpl.HalfDuplexCall)
.Build();
}
diff --git a/src/csharp/Grpc.IntegrationTesting/packages.config b/src/csharp/Grpc.IntegrationTesting/packages.config
index 51c17bc..157c264 100644
--- a/src/csharp/Grpc.IntegrationTesting/packages.config
+++ b/src/csharp/Grpc.IntegrationTesting/packages.config
@@ -2,4 +2,5 @@
<packages>
<package id="Google.ProtocolBuffers" version="2.4.1.521" targetFramework="net45" />
<package id="NUnit" version="2.6.4" targetFramework="net45" />
+ <package id="System.Collections.Immutable" version="1.1.34-rc" targetFramework="net45" />
</packages>
\ No newline at end of file
diff --git a/src/csharp/Settings.StyleCop b/src/csharp/Settings.StyleCop
index 094d93f..2ecf22f 100644
--- a/src/csharp/Settings.StyleCop
+++ b/src/csharp/Settings.StyleCop
@@ -1,7 +1,4 @@
<StyleCopSettings Version="105">
- <GlobalSettings>
- <StringProperty Name="MergeSettingsFiles">NoMerge</StringProperty>
- </GlobalSettings>
<Analyzers>
<Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules">
<Rules>
diff --git a/src/python/src/grpc/_adapter/_call.c b/src/python/src/grpc/_adapter/_call.c
index dca2e49..d8806e5 100644
--- a/src/python/src/grpc/_adapter/_call.c
+++ b/src/python/src/grpc/_adapter/_call.c
@@ -45,7 +45,7 @@
const PyObject *channel;
const char *method;
const char *host;
- const double deadline;
+ double deadline;
static char *kwlist[] = {"channel", "method", "host", "deadline", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!ssd:Call", kwlist,