MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
载入中...
搜索中...
未找到
plain_communicator.h
1/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
2miniob is licensed under Mulan PSL v2.
3You can use this software according to the terms and conditions of the Mulan PSL v2.
4You may obtain a copy of Mulan PSL v2 at:
5 http://license.coscl.org.cn/MulanPSL2
6THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
7EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
8MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
9See the Mulan PSL v2 for more details. */
10
11//
12// Created by Wangyunlai on 2023/06/25.
13//
14
15#pragma once
16
17#include "net/communicator.h"
18#include "common/lang/vector.h"
19
20class SqlResult;
21
28{
29public:
31 virtual ~PlainCommunicator() = default;
32
33 RC read_event(SessionEvent *&event) override;
34 RC write_result(SessionEvent *event, bool &need_disconnect) override;
35
36private:
37 RC write_state(SessionEvent *event, bool &need_disconnect);
38 RC write_debug(SessionEvent *event, bool &need_disconnect);
39 RC write_result_internal(SessionEvent *event, bool &need_disconnect);
40 RC write_tuple_result(SqlResult *sql_result);
41 RC write_chunk_result(SqlResult *sql_result);
42
43protected:
45 vector<char> debug_message_prefix_;
46};
负责与客户端通讯
Definition: communicator.h:42
与客户端进行通讯
Definition: plain_communicator.h:28
vector< char > debug_message_prefix_
调试信息前缀
Definition: plain_communicator.h:45
RC write_result(SessionEvent *event, bool &need_disconnect) override
在任务处理完成后,通过此接口将结果返回给客户端
Definition: plain_communicator.cpp:160
RC read_event(SessionEvent *&event) override
监听到有新的数据到达,调用此函数进行接收消息 如果需要创建新的任务来处理,那么就创建一个SessionEvent 对象并通过event参数返回。
Definition: plain_communicator.cpp:31
vector< char > send_message_delimiter_
发送消息分隔符
Definition: plain_communicator.h:44
表示一个SQL请求
Definition: session_event.h:29
SQL执行结果
Definition: sql_result.h:32