MySQL 8.0.39
Source Code Documentation
connection_base.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2021, 2024, Oracle and/or its affiliates.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is designed to work with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have either included with
14 the program or referenced in the documentation.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24*/
25
26#ifndef ROUTER_CONNECTION_POOL_CONNECTION_BASE_INCLUDED
27#define ROUTER_CONNECTION_POOL_CONNECTION_BASE_INCLUDED
28
29#include <cstdint> // size_t
30#include <functional>
31#include <system_error> // error_code
32#include <vector>
33
38
39/**
40 * virtual base-class of BasicConnection.
41 */
43 public:
44 virtual ~ConnectionBase() = default;
45
47 std::vector<uint8_t, default_init_allocator<uint8_t>>;
48
49 virtual net::io_context &io_ctx() = 0;
50
51 virtual void async_recv(
53 std::function<void(std::error_code ec, size_t transferred)>) = 0;
54
55 virtual void async_send(
57 std::function<void(std::error_code ec, size_t transferred)>) = 0;
58
59 virtual void async_wait_send(std::function<void(std::error_code ec)>) = 0;
60 virtual void async_wait_recv(std::function<void(std::error_code ec)>) = 0;
61 virtual void async_wait_error(std::function<void(std::error_code ec)>) = 0;
62
63 [[nodiscard]] virtual bool is_open() const = 0;
64
66 const = 0;
67
68 [[nodiscard]] virtual stdx::expected<void, std::error_code> close() = 0;
71
72 [[nodiscard]] virtual std::string endpoint() const = 0;
73
74 [[nodiscard]] virtual stdx::expected<void, std::error_code> cancel() = 0;
75
76 [[nodiscard]] virtual bool is_secure_transport() const = 0;
77
79 net::io_context &new_ctx) = 0;
80};
81
82#endif
virtual base-class of BasicConnection.
Definition: connection_base.h:42
virtual void async_send(recv_buffer_type &, std::function< void(std::error_code ec, size_t transferred)>)=0
std::vector< uint8_t, default_init_allocator< uint8_t > > recv_buffer_type
Definition: connection_base.h:47
virtual void async_wait_recv(std::function< void(std::error_code ec)>)=0
virtual stdx::expected< void, std::error_code > close()=0
virtual void async_recv(recv_buffer_type &, std::function< void(std::error_code ec, size_t transferred)>)=0
virtual void async_wait_send(std::function< void(std::error_code ec)>)=0
virtual bool is_secure_transport() const =0
virtual net::impl::socket::native_handle_type native_handle() const =0
virtual net::io_context & io_ctx()=0
virtual std::string endpoint() const =0
virtual bool is_open() const =0
virtual stdx::expected< void, std::error_code > shutdown(net::socket_base::shutdown_type st)=0
virtual stdx::expected< void, std::error_code > cancel()=0
virtual stdx::expected< void, std::error_code > set_io_context(net::io_context &new_ctx)=0
virtual void async_wait_error(std::function< void(std::error_code ec)>)=0
virtual ~ConnectionBase()=default
Definition: io_context.h:61
shutdown_type
Definition: socket.h:172
Definition: expected.h:944
int native_handle_type
Definition: socket_constants.h:51