MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
载入中...
搜索中...
未找到
cli_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/plain_communicator.h"
18
26{
27public:
28 CliCommunicator() = default;
29 virtual ~CliCommunicator() = default;
30
31 RC init(int fd, Session *session, const std::string &addr) override;
32 RC read_event(SessionEvent *&event) override;
33 RC write_result(SessionEvent *event, bool &need_disconnect) override;
34
35private:
36 int write_fd_ = -1;
37};
用于命令行模式的通讯器
Definition: cli_communicator.h:26
RC init(int fd, Session *session, const std::string &addr) override
接收到一个新的连接时,进行初始化
Definition: cli_communicator.cpp:102
int write_fd_
与使用远程通讯模式不同,如果读数据使用标准输入,那么输出应该是标准输出
Definition: cli_communicator.h:36
RC write_result(SessionEvent *event, bool &need_disconnect) override
在任务处理完成后,通过此接口将结果返回给客户端
Definition: cli_communicator.cpp:143
Session * session() const
关联的会话信息
Definition: communicator.h:69
const char * addr() const
对端地址 如果是unix socket,可能没有意义
Definition: communicator.h:86
struct event & read_event()
libevent使用的数据,参考server.cpp
Definition: communicator.h:77
与客户端进行通讯
Definition: plain_communicator.h:27
表示一个SQL请求
Definition: session_event.h:32
表示会话
Definition: session.h:28