aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp/GrpcCore/Call.cs
blob: bf257e5d5981a1ccfc2775256c6c33e9d0501f6f (plain)
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
68
69
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 TimeSpan timeout;
        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.timeout = timeout;
            this.channel = channel;
        }


        public Channel Channel
        {
            get
            {
                return this.channel;
            }
        }

        public TimeSpan Timeout
        {
            get
            {
                return this.timeout;
            }
        }

        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;
            }
        }
    }
}