Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Side by Side Diff: third_party/grpc/src/csharp/Grpc.Core/CallInvocationDetails.cs

Issue 1932353002: Initial checkin of gRPC to third_party/ Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #region Copyright notice and license
2
3 // Copyright 2015-2016, Google Inc.
4 // All rights reserved.
5 //
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions are
8 // met:
9 //
10 // * Redistributions of source code must retain the above copyright
11 // notice, this list of conditions and the following disclaimer.
12 // * Redistributions in binary form must reproduce the above
13 // copyright notice, this list of conditions and the following disclaimer
14 // in the documentation and/or other materials provided with the
15 // distribution.
16 // * Neither the name of Google Inc. nor the names of its
17 // contributors may be used to endorse or promote products derived from
18 // this software without specific prior written permission.
19 //
20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
32 #endregion
33
34 using System;
35 using Grpc.Core.Internal;
36 using Grpc.Core.Utils;
37
38 namespace Grpc.Core
39 {
40 /// <summary>
41 /// Details about a client-side call to be invoked.
42 /// </summary>
43 /// <typeparam name="TRequest">Request message type for the call.</typeparam >
44 /// <typeparam name="TResponse">Response message type for the call.</typepar am>
45 public struct CallInvocationDetails<TRequest, TResponse>
46 {
47 readonly Channel channel;
48 readonly string method;
49 readonly string host;
50 readonly Marshaller<TRequest> requestMarshaller;
51 readonly Marshaller<TResponse> responseMarshaller;
52 CallOptions options;
53
54 /// <summary>
55 /// Initializes a new instance of the <see cref="Grpc.Core.CallInvocatio nDetails{TRequest,TResponse}"/> struct.
56 /// </summary>
57 /// <param name="channel">Channel to use for this call.</param>
58 /// <param name="method">Method to call.</param>
59 /// <param name="options">Call options.</param>
60 public CallInvocationDetails(Channel channel, Method<TRequest, TResponse > method, CallOptions options) :
61 this(channel, method, null, options)
62 {
63 }
64
65 /// <summary>
66 /// Initializes a new instance of the <see cref="Grpc.Core.CallInvocatio nDetails{TRequest,TResponse}"/> struct.
67 /// </summary>
68 /// <param name="channel">Channel to use for this call.</param>
69 /// <param name="method">Method to call.</param>
70 /// <param name="host">Host that contains the method. if <c>null</c>, de fault host will be used.</param>
71 /// <param name="options">Call options.</param>
72 public CallInvocationDetails(Channel channel, Method<TRequest, TResponse > method, string host, CallOptions options) :
73 this(channel, method.FullName, host, method.RequestMarshaller, metho d.ResponseMarshaller, options)
74 {
75 }
76
77 /// <summary>
78 /// Initializes a new instance of the <see cref="Grpc.Core.CallInvocatio nDetails{TRequest,TResponse}"/> struct.
79 /// </summary>
80 /// <param name="channel">Channel to use for this call.</param>
81 /// <param name="method">Qualified method name.</param>
82 /// <param name="host">Host that contains the method.</param>
83 /// <param name="requestMarshaller">Request marshaller.</param>
84 /// <param name="responseMarshaller">Response marshaller.</param>
85 /// <param name="options">Call options.</param>
86 public CallInvocationDetails(Channel channel, string method, string host , Marshaller<TRequest> requestMarshaller, Marshaller<TResponse> responseMarshall er, CallOptions options)
87 {
88 this.channel = GrpcPreconditions.CheckNotNull(channel, "channel");
89 this.method = GrpcPreconditions.CheckNotNull(method, "method");
90 this.host = host;
91 this.requestMarshaller = GrpcPreconditions.CheckNotNull(requestMarsh aller, "requestMarshaller");
92 this.responseMarshaller = GrpcPreconditions.CheckNotNull(responseMar shaller, "responseMarshaller");
93 this.options = options;
94 }
95
96 /// <summary>
97 /// Get channel associated with this call.
98 /// </summary>
99 public Channel Channel
100 {
101 get
102 {
103 return this.channel;
104 }
105 }
106
107 /// <summary>
108 /// Gets name of method to be called.
109 /// </summary>
110 public string Method
111 {
112 get
113 {
114 return this.method;
115 }
116 }
117
118 /// <summary>
119 /// Get name of host.
120 /// </summary>
121 public string Host
122 {
123 get
124 {
125 return this.host;
126 }
127 }
128
129 /// <summary>
130 /// Gets marshaller used to serialize requests.
131 /// </summary>
132 public Marshaller<TRequest> RequestMarshaller
133 {
134 get
135 {
136 return this.requestMarshaller;
137 }
138 }
139
140 /// <summary>
141 /// Gets marshaller used to deserialized responses.
142 /// </summary>
143 public Marshaller<TResponse> ResponseMarshaller
144 {
145 get
146 {
147 return this.responseMarshaller;
148 }
149 }
150
151 /// <summary>
152 /// Gets the call options.
153 /// </summary>
154 public CallOptions Options
155 {
156 get
157 {
158 return options;
159 }
160 }
161
162 /// <summary>
163 /// Returns new instance of <see cref="CallInvocationDetails{TRequest, T Response}"/> with
164 /// <c>Options</c> set to the value provided. Values of all other fields are preserved.
165 /// </summary>
166 public CallInvocationDetails<TRequest, TResponse> WithOptions(CallOption s options)
167 {
168 var newDetails = this;
169 newDetails.options = options;
170 return newDetails;
171 }
172 }
173 }
OLDNEW
« no previous file with comments | « third_party/grpc/src/csharp/Grpc.Core/CallCredentials.cs ('k') | third_party/grpc/src/csharp/Grpc.Core/CallOptions.cs » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698