MySQL 8.4.0
Source Code Documentation
await_client_or_server.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2023, 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 ROUTING_CLASSIC_AWAIT_CLIENT_OR_SERVER_PROCESSOR_INCLUDED
27#define ROUTING_CLASSIC_AWAIT_CLIENT_OR_SERVER_PROCESSOR_INCLUDED
28
29#include "processor.h"
30
32 public:
33 enum class AwaitResult {
36 };
37
40 std::function<void(stdx::expected<AwaitResult, std::error_code>)> on_done)
41 : BasicProcessor(conn), on_done_(std::move(on_done)) {}
42
44
45 private:
46 enum class Stage {
47 Init,
51 Done,
52 };
53
55 Stage stage() const { return stage_; }
56
61
63
65};
66
67#endif
Definition: await_client_or_server.h:31
Stage
Definition: await_client_or_server.h:46
Stage stage() const
Definition: await_client_or_server.h:55
void stage(Stage stage)
Definition: await_client_or_server.h:54
AwaitClientOrServerProcessor(MysqlRoutingClassicConnectionBase *conn, std::function< void(stdx::expected< AwaitResult, std::error_code >)> on_done)
Definition: await_client_or_server.h:38
stdx::expected< Result, std::error_code > wait_both()
wait for an read-event from client and server at the same time.
Definition: await_client_or_server.cc:68
std::function< void(stdx::expected< AwaitResult, std::error_code >)> on_done_
Definition: await_client_or_server.h:64
stdx::expected< Result, std::error_code > init()
Definition: await_client_or_server.cc:49
stdx::expected< Result, std::error_code > wait_server_cancelled()
Definition: await_client_or_server.cc:104
Stage stage_
Definition: await_client_or_server.h:62
stdx::expected< Result, std::error_code > process() override
Definition: await_client_or_server.cc:31
AwaitResult
Definition: await_client_or_server.h:33
stdx::expected< Result, std::error_code > wait_client_cancelled()
read-event from server while waiting for client command.
Definition: await_client_or_server.cc:119
base class of all the processors.
Definition: processor.h:57
Definition: classic_connection_base.h:56
Definition: expected.h:284
Definition: gcs_xcom_synode.h:64