1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
using System;
using Google.GRPC.Core.Internal;
namespace Google.GRPC.Core
{
public class Call<TRequest, TResponse>
{
readonly string methodName;
readonly Func<TRequest, byte[]> requestSerializer;
readonly Func<byte[], TResponse> responseDeserializer;
readonly Channel channel;
// TODO: channel param should be removed in the future.
public Call(string methodName,
Func<TRequest, byte[]> requestSerializer,
Func<byte[], TResponse> responseDeserializer,
TimeSpan timeout,
Channel channel) {
this.methodName = methodName;
this.requestSerializer = requestSerializer;
this.responseDeserializer = responseDeserializer;
this.channel = channel;
}
// TODO: channel param should be removed in the future.
public Call(Method<TRequest, TResponse> method, Channel channel)
{
this.methodName = method.Name;
this.requestSerializer = method.RequestMarshaller.Serialize;
this.responseDeserializer = method.ResponseMarshaller.Deserialize;
this.channel = channel;
}
public Channel Channel
{
get
{
return this.channel;
}
}
public string MethodName
{
get
{
return this.methodName;
}
}
public Func<TRequest, byte[]> RequestSerializer
{
get
{
return this.requestSerializer;
}
}
public Func<byte[], TResponse> ResponseDeserializer
{
get
{
return this.responseDeserializer;
}
}
}
}
|