/Users/deen/code/yugabyte-db/src/yb/gen_yrpc/substitutions.h
Line | Count | Source (jump to first uncovered line) |
1 | | // Copyright (c) YugaByte, Inc. |
2 | | // |
3 | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
4 | | // in compliance with the License. You may obtain a copy of the License at |
5 | | // |
6 | | // http://www.apache.org/licenses/LICENSE-2.0 |
7 | | // |
8 | | // Unless required by applicable law or agreed to in writing, software distributed under the License |
9 | | // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
10 | | // or implied. See the License for the specific language governing permissions and limitations |
11 | | // under the License. |
12 | | // |
13 | | |
14 | | #ifndef YB_GEN_YRPC_SUBSTITUTIONS_H |
15 | | #define YB_GEN_YRPC_SUBSTITUTIONS_H |
16 | | |
17 | | #include <map> |
18 | | |
19 | | #include "yb/gen_yrpc/gen_yrpc_fwd.h" |
20 | | |
21 | | #include "yb/rpc/lightweight_message.pb.h" |
22 | | |
23 | | #include "yb/util/status.h" |
24 | | |
25 | | namespace yb { |
26 | | namespace gen_yrpc { |
27 | | |
28 | | class FileSubstitutions { |
29 | | public: |
30 | | explicit FileSubstitutions(const google::protobuf::FileDescriptor* file); |
31 | | |
32 | | Substitutions Create(); |
33 | | |
34 | 0 | std::string service() const { |
35 | 0 | return path_no_extension_ + ".service"; |
36 | 0 | } |
37 | | |
38 | 0 | std::string proxy() const { |
39 | 0 | return path_no_extension_ + ".proxy"; |
40 | 0 | } |
41 | | |
42 | 0 | std::string messages() const { |
43 | 0 | return path_no_extension_ + ".messages"; |
44 | 0 | } |
45 | | |
46 | 0 | std::string forward() const { |
47 | 0 | return path_no_extension_ + ".fwd"; |
48 | 0 | } |
49 | | |
50 | | private: |
51 | | const google::protobuf::FileDescriptor* file_; |
52 | | std::string path_no_extension_; |
53 | | }; |
54 | | |
55 | | Substitutions CreateSubstitutions(const google::protobuf::Descriptor* message); |
56 | | Substitutions CreateSubstitutions( |
57 | | const google::protobuf::MethodDescriptor* method, rpc::RpcSides side); |
58 | | Substitutions CreateSubstitutions(const google::protobuf::FieldDescriptor* field); |
59 | | Substitutions CreateSubstitutions(const google::protobuf::ServiceDescriptor* service); |
60 | | |
61 | | } // namespace gen_yrpc |
62 | | } // namespace yb |
63 | | |
64 | | #endif // YB_GEN_YRPC_SUBSTITUTIONS_H |