- Notifications
You must be signed in to change notification settings - Fork 4k
/
Copy pathprotocol_encoder_compression.h
113 lines (95 loc) · 4.67 KB
/
protocol_encoder_compression.h
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*
* Copyright (c) 2019, 2025, Oracle and/or its affiliates.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2.0,
* as published by the Free Software Foundation.
*
* This program is designed to work with certain software (including
* but not limited to OpenSSL) that is licensed under separate terms,
* as designated in a particular file or component or in included license
* documentation. The authors of MySQL hereby grant you an additional
* permission to link the program and your derivative works with the
* separately licensed software that they have either included with
* the program or referenced in the documentation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License, version 2.0, for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef PLUGIN_X_SRC_NGS_PROTOCOL_ENCODER_COMPRESSION_H_
#definePLUGIN_X_SRC_NGS_PROTOCOL_ENCODER_COMPRESSION_H_
#include<memory>
#include<string>
#include<vector>
#include"my_inttypes.h"// NOLINT(build/include_subdir)
#include"plugin/x/protocol/encoders/encoding_xrow.h"
#include"plugin/x/src/interface/protocol_encoder.h"
#include"plugin/x/src/interface/protocol_monitor.h"
#include"plugin/x/src/ngs/compression_types.h"
#include"plugin/x/src/ngs/error_code.h"
#include"plugin/x/src/ngs/memory.h"
namespacengs {
classProtocol_flusher_compression;
classProtocol_encoder_compression : publicxpl::iface::Protocol_encoder {
public:
using Protocol_encoder_ptr =
ngs::Memory_instrumented<xpl::iface::Protocol_encoder>::Unique_ptr;
Protocol_encoder_compression(Protocol_encoder_ptr protocol_encoder,
xpl::iface::Protocol_monitor *monitor,
Error_handler ehandler,
Memory_block_pool *memory_block_pool);
public:// Protocol_encoder_interface
xpl::iface::Protocol_flusher *get_flusher() override;
boolis_building_row() constoverride;
std::unique_ptr<xpl::iface::Protocol_flusher> set_flusher(
std::unique_ptr<xpl::iface::Protocol_flusher> flusher) override;
Metadata_builder *get_metadata_builder() override;
boolsend_result(const Error_code &result) override;
boolsend_ok() override;
boolsend_ok(const std::string &message) override;
boolsend_error(const Error_code &error_code,
constbool init_error = false) override;
voidsend_notice_rows_affected(constuint64_t value) override;
voidsend_notice_client_id(constuint64_t id) override;
voidsend_notice_last_insert_id(constuint64_t id) override;
voidsend_notice_txt_message(const std::string &message) override;
voidsend_notice_account_expired() override;
voidsend_notice_generated_document_ids(
const std::vector<std::string> &ids) override;
boolsend_notice(const xpl::iface::Frame_type type,
const xpl::iface::Frame_scope scope, const std::string &data,
constbool force_flush = false) override;
voidsend_auth_ok(const std::string &data) override;
voidsend_auth_continue(const std::string &data) override;
boolsend_exec_ok() override;
boolsend_result_fetch_done() override;
boolsend_result_fetch_suspended() override;
boolsend_result_fetch_done_more_results() override;
boolsend_result_fetch_done_more_out_params() override;
boolsend_column_metadata(const Encode_column_info *column_info) override;
protocol::XMessage_encoder *raw_encoder() override;
protocol::XRow_encoder *row_builder() override;
voidstart_row() override;
voidabort_row() override;
boolsend_row() override;
boolsend_protobuf_message(constuint8_t type, const Message &message,
bool force_buffer_flush = false) override;
voidon_error(int error) override;
xpl::iface::Protocol_monitor &get_protocol_monitor() override;
public:
voidset_compression_options(const Compression_algorithm algo,
const Compression_style style,
constint64_t max_msg, constint32_t level);
private:
Protocol_flusher_compression *get_comp_flusher();
voidhandle_compression(constuint8_t id, constbool can_be_compressed);
ngs::Memory_instrumented<xpl::iface::Protocol_encoder>::Unique_ptr m_encoder;
};
} // namespace ngs
#endif// PLUGIN_X_SRC_NGS_PROTOCOL_ENCODER_COMPRESSION_H_