1 | /******************************************************************** |
2 | * Copyright (c) 2013 - 2014, Pivotal Inc. |
3 | * All rights reserved. |
4 | * |
5 | * Author: Zhanwei Wang |
6 | ********************************************************************/ |
7 | /******************************************************************** |
8 | * 2014 - |
9 | * open source under Apache License Version 2.0 |
10 | ********************************************************************/ |
11 | /** |
12 | * Licensed to the Apache Software Foundation (ASF) under one |
13 | * or more contributor license agreements. See the NOTICE file |
14 | * distributed with this work for additional information |
15 | * regarding copyright ownership. The ASF licenses this file |
16 | * to you under the Apache License, Version 2.0 (the |
17 | * "License"); you may not use this file except in compliance |
18 | * with the License. You may obtain a copy of the License at |
19 | * |
20 | * http://www.apache.org/licenses/LICENSE-2.0 |
21 | * |
22 | * Unless required by applicable law or agreed to in writing, software |
23 | * distributed under the License is distributed on an "AS IS" BASIS, |
24 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
25 | * See the License for the specific language governing permissions and |
26 | * limitations under the License. |
27 | */ |
28 | #ifndef _HDFS_LIBHDFS3_RPC_RPCCALL_H_ |
29 | #define _HDFS_LIBHDFS3_RPC_RPCCALL_H_ |
30 | |
31 | #include "google/protobuf/message.h" |
32 | |
33 | namespace Hdfs { |
34 | namespace Internal { |
35 | |
36 | class RpcCall { |
37 | public: |
38 | RpcCall(bool idemp, std::string n, google::protobuf::Message * req, |
39 | google::protobuf::Message * resp) : |
40 | idempotent(idemp), name(n), request(req), response(resp) { |
41 | } |
42 | |
43 | bool isIdempotent() const { |
44 | return idempotent; |
45 | } |
46 | |
47 | const char * getName() const { |
48 | return name.c_str(); |
49 | } |
50 | |
51 | void setIdempotent(bool idempotent) { |
52 | this->idempotent = idempotent; |
53 | } |
54 | |
55 | void setName(const std::string & name) { |
56 | this->name = name; |
57 | } |
58 | |
59 | google::protobuf::Message * getRequest() { |
60 | return request; |
61 | } |
62 | |
63 | void setRequest(google::protobuf::Message * request) { |
64 | this->request = request; |
65 | } |
66 | |
67 | google::protobuf::Message * getResponse() { |
68 | return response; |
69 | } |
70 | |
71 | void setResponse(google::protobuf::Message * response) { |
72 | this->response = response; |
73 | } |
74 | |
75 | private: |
76 | bool idempotent; |
77 | std::string name; |
78 | google::protobuf::Message * request; |
79 | google::protobuf::Message * response; |
80 | }; |
81 | |
82 | } |
83 | } |
84 | #endif /* _HDFS_LIBHDFS3_RPC_RPCCALL_H_ */ |
85 | |