/proc/self/cwd/source/extensions/common/dubbo/serializer.h
Line | Count | Source (jump to first uncovered line) |
1 | | #pragma once |
2 | | |
3 | | #include <string> |
4 | | |
5 | | #include "envoy/buffer/buffer.h" |
6 | | #include "envoy/config/typed_config.h" |
7 | | |
8 | | #include "source/common/common/assert.h" |
9 | | #include "source/common/config/utility.h" |
10 | | #include "source/common/singleton/const_singleton.h" |
11 | | #include "source/extensions/common/dubbo/message.h" |
12 | | #include "source/extensions/common/dubbo/metadata.h" |
13 | | |
14 | | namespace Envoy { |
15 | | namespace Extensions { |
16 | | namespace Common { |
17 | | namespace Dubbo { |
18 | | |
19 | | class Serializer { |
20 | | public: |
21 | 0 | virtual ~Serializer() = default; |
22 | | |
23 | | virtual SerializeType type() const PURE; |
24 | | |
25 | | /** |
26 | | * Deserialize an rpc call. If successful, the RpcRequest removed from the buffer |
27 | | * |
28 | | * @param buffer the currently buffered dubbo data |
29 | | * @param context context information for RPC messages |
30 | | * @return a pair containing the deserialized result of the message and the deserialized |
31 | | * invocation information. |
32 | | * @throws EnvoyException if the data is not valid for this serialization |
33 | | */ |
34 | | virtual RpcRequestPtr deserializeRpcRequest(Buffer::Instance& buffer, Context& context) PURE; |
35 | | |
36 | | /** |
37 | | * deserialize result of an rpc call |
38 | | * |
39 | | * @param buffer the currently buffered dubbo data |
40 | | * @param context context information for RPC messages |
41 | | * @return a pair containing the deserialized result of the message and the deserialized |
42 | | * result information. |
43 | | * @throws EnvoyException if the data is not valid for this serialization |
44 | | */ |
45 | | virtual RpcResponsePtr deserializeRpcResponse(Buffer::Instance& buffer, Context& context) PURE; |
46 | | |
47 | | /** |
48 | | * Serialize response of an rpc call |
49 | | * If successful, the buffer is written to the serialized data |
50 | | * |
51 | | * @param buffer store the serialized data |
52 | | * @param metadata metadata that contains context information and rpc response. |
53 | | */ |
54 | | virtual void serializeRpcResponse(Buffer::Instance& buffer, MessageMetadata& metadata) PURE; |
55 | | |
56 | | /** |
57 | | * Serialize request of an rpc call |
58 | | * If successful, the buffer is written to the serialized data |
59 | | * |
60 | | * @param buffer store the serialized data |
61 | | * @param metadata metadata that contains context information and rpc request. |
62 | | */ |
63 | | virtual void serializeRpcRequest(Buffer::Instance& buffer, MessageMetadata& metadata) PURE; |
64 | | }; |
65 | | |
66 | | using SerializerPtr = std::unique_ptr<Serializer>; |
67 | | |
68 | | } // namespace Dubbo |
69 | | } // namespace Common |
70 | | } // namespace Extensions |
71 | | } // namespace Envoy |