aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@google.com>2015-08-10 22:51:29 -0700
committerGravatar Jan Tattermusch <jtattermusch@google.com>2015-08-10 22:51:29 -0700
commit1b926ee4ddde9b13c4f1b8a2e1c4d6684ea4c1fe (patch)
treec487014d1d4c64b5615bfc4c70ca6bb123a0fe64
parent9698b5b29f84707ca590c2f618c8f5d00a921da7 (diff)
add comments
-rw-r--r--src/csharp/Grpc.Core/CallInvocationDetails.cs40
-rw-r--r--src/csharp/Grpc.Core/Calls.cs44
2 files changed, 84 insertions, 0 deletions
diff --git a/src/csharp/Grpc.Core/CallInvocationDetails.cs b/src/csharp/Grpc.Core/CallInvocationDetails.cs
index 8959baf306..6565073fc5 100644
--- a/src/csharp/Grpc.Core/CallInvocationDetails.cs
+++ b/src/csharp/Grpc.Core/CallInvocationDetails.cs
@@ -49,16 +49,38 @@ namespace Grpc.Core
readonly Marshaller<TResponse> responseMarshaller;
CallOptions options;
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Grpc.Core.CallInvocationDetails`2"/> struct.
+ /// </summary>
+ /// <param name="channel">Channel to use for this call.</param>
+ /// <param name="method">Method to call.</param>
+ /// <param name="options">Call options.</param>
public CallInvocationDetails(Channel channel, Method<TRequest, TResponse> method, CallOptions options) :
this(channel, method, null, options)
{
}
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Grpc.Core.CallInvocationDetails`2"/> struct.
+ /// </summary>
+ /// <param name="channel">Channel to use for this call.</param>
+ /// <param name="method">Method to call.</param>
+ /// <param name="host">Host that contains the method. if <c>null</c>, default host will be used.</param>
+ /// <param name="options">Call options.</param>
public CallInvocationDetails(Channel channel, Method<TRequest, TResponse> method, string host, CallOptions options) :
this(channel, method.FullName, host, method.RequestMarshaller, method.ResponseMarshaller, options)
{
}
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Grpc.Core.CallInvocationDetails`2"/> struct.
+ /// </summary>
+ /// <param name="channel">Channel to use for this call.</param>
+ /// <param name="method">Qualified method name.</param>
+ /// <param name="host">Host that contains the method.</param>
+ /// <param name="requestMarshaller">Request marshaller.</param>
+ /// <param name="responseMarshaller">Response marshaller.</param>
+ /// <param name="options">Call options.</param>
public CallInvocationDetails(Channel channel, string method, string host, Marshaller<TRequest> requestMarshaller, Marshaller<TResponse> responseMarshaller, CallOptions options)
{
this.channel = Preconditions.CheckNotNull(channel, "channel");
@@ -69,6 +91,9 @@ namespace Grpc.Core
this.options = options;
}
+ /// <summary>
+ /// Get channel associated with this call.
+ /// </summary>
public Channel Channel
{
get
@@ -77,6 +102,9 @@ namespace Grpc.Core
}
}
+ /// <summary>
+ /// Gets name of method to be called.
+ /// </summary>
public string Method
{
get
@@ -85,6 +113,9 @@ namespace Grpc.Core
}
}
+ /// <summary>
+ /// Get name of host.
+ /// </summary>
public string Host
{
get
@@ -93,6 +124,9 @@ namespace Grpc.Core
}
}
+ /// <summary>
+ /// Gets marshaller used to serialize requests.
+ /// </summary>
public Marshaller<TRequest> RequestMarshaller
{
get
@@ -101,6 +135,9 @@ namespace Grpc.Core
}
}
+ /// <summary>
+ /// Gets marshaller used to deserialized responses.
+ /// </summary>
public Marshaller<TResponse> ResponseMarshaller
{
get
@@ -109,6 +146,9 @@ namespace Grpc.Core
}
}
+ /// <summary>
+ /// Gets the call options.
+ /// </summary>
public CallOptions Options
{
get
diff --git a/src/csharp/Grpc.Core/Calls.cs b/src/csharp/Grpc.Core/Calls.cs
index b9128c914d..7067456638 100644
--- a/src/csharp/Grpc.Core/Calls.cs
+++ b/src/csharp/Grpc.Core/Calls.cs
@@ -38,9 +38,20 @@ namespace Grpc.Core
{
/// <summary>
/// Helper methods for generated clients to make RPC calls.
+ /// Most users will use this class only indirectly and will be
+ /// making calls using client object generated from protocol
+ /// buffer definition files.
/// </summary>
public static class Calls
{
+ /// <summary>
+ /// Invokes a simple remote call in a blocking fashion.
+ /// </summary>
+ /// <returns>The response.</returns>
+ /// <param name="call">The call defintion.</param>
+ /// <param name="req">Request message.</param>
+ /// <typeparam name="TRequest">Type of request message.</typeparam>
+ /// <typeparam name="TResponse">The of response message.</typeparam>
public static TResponse BlockingUnaryCall<TRequest, TResponse>(CallInvocationDetails<TRequest, TResponse> call, TRequest req)
where TRequest : class
where TResponse : class
@@ -49,6 +60,14 @@ namespace Grpc.Core
return asyncCall.UnaryCall(req);
}
+ /// <summary>
+ /// Invokes a simple remote call asynchronously.
+ /// </summary>
+ /// <returns>An awaitable call object providing access to the response.</returns>
+ /// <param name="call">The call defintion.</param>
+ /// <param name="req">Request message.</param>
+ /// <typeparam name="TRequest">Type of request message.</typeparam>
+ /// <typeparam name="TResponse">The of response message.</typeparam>
public static AsyncUnaryCall<TResponse> AsyncUnaryCall<TRequest, TResponse>(CallInvocationDetails<TRequest, TResponse> call, TRequest req)
where TRequest : class
where TResponse : class
@@ -58,6 +77,15 @@ namespace Grpc.Core
return new AsyncUnaryCall<TResponse>(asyncResult, asyncCall.GetStatus, asyncCall.GetTrailers, asyncCall.Cancel);
}
+ /// <summary>
+ /// Invokes a server streaming call asynchronously.
+ /// In server streaming scenario, client sends on request and server responds with a stream of responses.
+ /// </summary>
+ /// <returns>A call object providing access to the asynchronous response stream.</returns>
+ /// <param name="call">The call defintion.</param>
+ /// <param name="req">Request message.</param>
+ /// <typeparam name="TRequest">Type of request message.</typeparam>
+ /// <typeparam name="TResponse">The of response messages.</typeparam>
public static AsyncServerStreamingCall<TResponse> AsyncServerStreamingCall<TRequest, TResponse>(CallInvocationDetails<TRequest, TResponse> call, TRequest req)
where TRequest : class
where TResponse : class
@@ -68,6 +96,13 @@ namespace Grpc.Core
return new AsyncServerStreamingCall<TResponse>(responseStream, asyncCall.GetStatus, asyncCall.GetTrailers, asyncCall.Cancel);
}
+ /// <summary>
+ /// Invokes a client streaming call asynchronously.
+ /// In client streaming scenario, client sends a stream of requests and server responds with a single response.
+ /// </summary>
+ /// <returns>An awaitable call object providing access to the response.</returns>
+ /// <typeparam name="TRequest">Type of request messages.</typeparam>
+ /// <typeparam name="TResponse">The of response message.</typeparam>
public static AsyncClientStreamingCall<TRequest, TResponse> AsyncClientStreamingCall<TRequest, TResponse>(CallInvocationDetails<TRequest, TResponse> call)
where TRequest : class
where TResponse : class
@@ -78,6 +113,15 @@ namespace Grpc.Core
return new AsyncClientStreamingCall<TRequest, TResponse>(requestStream, resultTask, asyncCall.GetStatus, asyncCall.GetTrailers, asyncCall.Cancel);
}
+ /// <summary>
+ /// Invokes a duplex streaming call asynchronously.
+ /// In duplex streaming scenario, client sends a stream of requests and server responds with a stream of responses.
+ /// The response stream is completely independent and both side can be sending messages at the same time.
+ /// </summary>
+ /// <returns>A call object providing access to the asynchronous request and response streams.</returns>
+ /// <param name="call">The call definition.</param>
+ /// <typeparam name="TRequest">Type of request messages.</typeparam>
+ /// <typeparam name="TResponse">Type of reponse messages.</typeparam>
public static AsyncDuplexStreamingCall<TRequest, TResponse> AsyncDuplexStreamingCall<TRequest, TResponse>(CallInvocationDetails<TRequest, TResponse> call)
where TRequest : class
where TResponse : class