mariadb/storage/spider/hs_client/hstcpcli.hpp
Vicențiu Ciorbaru 08c852026d Apply clang-tidy to remove empty constructors / destructors
This patch is the result of running
run-clang-tidy -fix -header-filter=.* -checks='-*,modernize-use-equals-default' .

Code style changes have been done on top. The result of this change
leads to the following improvements:

1. Binary size reduction.
* For a -DBUILD_CONFIG=mysql_release build, the binary size is reduced by
  ~400kb.
* A raw -DCMAKE_BUILD_TYPE=Release reduces the binary size by ~1.4kb.

2. Compiler can better understand the intent of the code, thus it leads
   to more optimization possibilities. Additionally it enabled detecting
   unused variables that had an empty default constructor but not marked
   so explicitly.

   Particular change required following this patch in sql/opt_range.cc

   result_keys, an unused template class Bitmap now correctly issues
   unused variable warnings.

   Setting Bitmap template class constructor to default allows the compiler
   to identify that there are no side-effects when instantiating the class.
   Previously the compiler could not issue the warning as it assumed Bitmap
   class (being a template) would not be performing a NO-OP for its default
   constructor. This prevented the "unused variable warning".
2023-02-09 16:09:08 +02:00

98 lines
2.9 KiB
C++

// vim:sw=2:ai
/*
* Copyright (C) 2010-2011 DeNA Co.,Ltd.. All rights reserved.
* Copyright (C) 2011 Kentoku SHIBA
* See COPYRIGHT.txt for details.
*/
#ifndef DENA_HSTCPCLI_HPP
#define DENA_HSTCPCLI_HPP
#define HANDLERSOCKET_MYSQL_UTIL 1
#include "mysql_version.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
#include <mysql/plugin.h>
#else
#include "sql_priv.h"
#include "probes_mysql.h"
#endif
#include "config.hpp"
#include "socket.hpp"
#include "string_ref.hpp"
#include "string_buffer.hpp"
namespace dena {
struct hstcpcli_filter {
string_ref filter_type;
string_ref op;
size_t ff_offset;
string_ref val;
hstcpcli_filter() : ff_offset(0) { }
};
struct hstcpcli_i;
typedef hstcpcli_i *hstcpcli_ptr;
struct hstresult {
hstresult();
virtual ~hstresult();
string_buffer readbuf;
size_t response_end_offset;
size_t num_flds;
size_t cur_row_offset;
size_t cur_row_size;
DYNAMIC_ARRAY flds;
};
struct hstcpcli_i {
virtual ~hstcpcli_i() = default;
virtual void close() = 0;
virtual int reconnect() = 0;
virtual bool stable_point() = 0;
virtual void request_buf_auth(const char *secret, const char *typ) = 0;
virtual void request_buf_open_index(size_t pst_id, const char *dbn,
const char *tbl, const char *idx, const char *retflds,
const char *filflds = 0) = 0;
virtual void request_buf_exec_generic(size_t pst_id, const string_ref& op,
const string_ref *kvs, size_t kvslen, uint32 limit, uint32 skip,
const string_ref& mod_op, const string_ref *mvs, size_t mvslen,
const hstcpcli_filter *fils = 0, size_t filslen = 0,
int invalues_keypart = -1, const string_ref *invalues = 0,
size_t invalueslen = 0) = 0; // FIXME: too long
virtual size_t request_buf_append(const char *start, const char *finish) = 0;
virtual void request_reset() = 0;
virtual int request_send() = 0;
virtual int response_recv(size_t& num_flds_r) = 0;
virtual int get_result(hstresult& result) = 0;
virtual const string_ref *get_next_row() = 0;
virtual const string_ref *get_next_row_from_result(hstresult& result) = 0;
virtual size_t get_row_size() = 0;
virtual size_t get_row_size_from_result(hstresult& result) = 0;
virtual void response_buf_remove() = 0;
virtual int get_error_code() = 0;
virtual String& get_error() = 0;
virtual void clear_error() = 0;
virtual int set_timeout(int send_timeout, int recv_timeout) = 0;
virtual size_t get_num_req_bufd() = 0;
virtual size_t get_num_req_sent() = 0;
virtual size_t get_num_req_rcvd() = 0;
virtual size_t get_response_end_offset() = 0;
virtual const char *get_readbuf_begin() = 0;
virtual const char *get_readbuf_end() = 0;
virtual const char *get_writebuf_begin() = 0;
virtual size_t get_writebuf_size() = 0;
virtual void write_error_to_log(const char *func_name, const char *file_name,
ulong line_no) = 0;
static hstcpcli_ptr create(const socket_args& args);
};
};
#endif