aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs
diff options
context:
space:
mode:
authorGravatar Alistair Veitch <aveitch@google.com>2015-08-25 15:36:20 -0700
committerGravatar Alistair Veitch <aveitch@google.com>2015-08-25 15:36:20 -0700
commita4e884721d4333eef8b208b26ff35f1dde25b6c1 (patch)
treea82dabdddbe7d00190be04b299a378aed4041f24 /src/csharp/Grpc.Core/AsyncClientStreamingCall.cs
parentf886985d2c775d480079ea979323ae22efc0afc6 (diff)
parent3cfb4795ceaaebff3b33f2ef7612ffcff72b53ab (diff)
merge to head
Diffstat (limited to 'src/csharp/Grpc.Core/AsyncClientStreamingCall.cs')
-rw-r--r--src/csharp/Grpc.Core/AsyncClientStreamingCall.cs35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs b/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs
index bf020cd627..5646fed3d9 100644
--- a/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs
+++ b/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs
@@ -40,18 +40,22 @@ namespace Grpc.Core
/// <summary>
/// Return type for client streaming calls.
/// </summary>
+ /// <typeparam name="TRequest">Request message type for this call.</typeparam>
+ /// <typeparam name="TResponse">Response message type for this call.</typeparam>
public sealed class AsyncClientStreamingCall<TRequest, TResponse> : IDisposable
{
readonly IClientStreamWriter<TRequest> requestStream;
readonly Task<TResponse> responseAsync;
+ readonly Task<Metadata> responseHeadersAsync;
readonly Func<Status> getStatusFunc;
readonly Func<Metadata> getTrailersFunc;
readonly Action disposeAction;
- public AsyncClientStreamingCall(IClientStreamWriter<TRequest> requestStream, Task<TResponse> responseAsync, Func<Status> getStatusFunc, Func<Metadata> getTrailersFunc, Action disposeAction)
+ internal AsyncClientStreamingCall(IClientStreamWriter<TRequest> requestStream, Task<TResponse> responseAsync, Task<Metadata> responseHeadersAsync, Func<Status> getStatusFunc, Func<Metadata> getTrailersFunc, Action disposeAction)
{
this.requestStream = requestStream;
this.responseAsync = responseAsync;
+ this.responseHeadersAsync = responseHeadersAsync;
this.getStatusFunc = getStatusFunc;
this.getTrailersFunc = getTrailersFunc;
this.disposeAction = disposeAction;
@@ -69,6 +73,17 @@ namespace Grpc.Core
}
/// <summary>
+ /// Asynchronous access to response headers.
+ /// </summary>
+ public Task<Metadata> ResponseHeadersAsync
+ {
+ get
+ {
+ return this.responseHeadersAsync;
+ }
+ }
+
+ /// <summary>
/// Async stream to send streaming requests.
/// </summary>
public IClientStreamWriter<TRequest> RequestStream
@@ -89,6 +104,24 @@ namespace Grpc.Core
}
/// <summary>
+ /// Gets the call status if the call has already finished.
+ /// Throws InvalidOperationException otherwise.
+ /// </summary>
+ public Status GetStatus()
+ {
+ return getStatusFunc();
+ }
+
+ /// <summary>
+ /// Gets the call trailing metadata if the call has already finished.
+ /// Throws InvalidOperationException otherwise.
+ /// </summary>
+ public Metadata GetTrailers()
+ {
+ return getTrailersFunc();
+ }
+
+ /// <summary>
/// Provides means to cleanup after the call.
/// If the call has already finished normally (request stream has been completed and call result has been received), doesn't do anything.
/// Otherwise, requests cancellation of the call which should terminate all pending async operations associated with the call.