• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #region Copyright notice and license
2 
3 // Copyright 2018 gRPC authors.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 
17 #endregion
18 
19 using System;
20 using System.Reflection;
21 using System.Threading.Tasks;
22 using Grpc.Core.Internal;
23 
24 namespace Grpc.Core.Interceptors
25 {
26     /// <summary>
27     /// Carries along the context associated with intercepted invocations on the client side.
28     /// </summary>
29     public struct ClientInterceptorContext<TRequest, TResponse>
30         where TRequest : class
31         where TResponse : class
32     {
33         /// <summary>
34         /// Creates a new instance of <see cref="Grpc.Core.Interceptors.ClientInterceptorContext{TRequest, TResponse}" />
35         /// with the specified method, host, and call options.
36         /// </summary>
37         /// <param name="method">A <see cref="Grpc.Core.Method{TRequest, TResponse}"/> object representing the method to be invoked.</param>
38         /// <param name="host">The host to dispatch the current call to.</param>
39         /// <param name="options">A <see cref="Grpc.Core.CallOptions"/> instance containing the call options of the current call.</param>
ClientInterceptorContextGrpc.Core.Interceptors.TRequest40         public ClientInterceptorContext(Method<TRequest, TResponse> method, string host, CallOptions options)
41         {
42             Method = method;
43             Host = host;
44             Options = options;
45         }
46 
47         /// <summary>
48         /// Gets the <see cref="Grpc.Core.Method{TRequest, TResponse}"/> instance
49         /// representing the method to be invoked.
50         /// </summary>
51         public Method<TRequest, TResponse> Method { get; }
52 
53         /// <summary>
54         /// Gets the host that the currect invocation will be dispatched to.
55         /// </summary>
56         public string Host { get; }
57 
58         /// <summary>
59         /// Gets the <see cref="Grpc.Core.CallOptions"/> structure representing the
60         /// call options associated with the current invocation.
61         /// </summary>
62         public CallOptions Options { get; }
63     }
64 }
65