-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add echo command #72
Conversation
WalkthroughThe changes introduced in this pull request involve the addition of a new command named Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant CmdTableManager
participant EchoCmd
Client->>CmdTableManager: Request Echo Command
CmdTableManager->>EchoCmd: Initialize Command
EchoCmd->>Client: Return Echo Response
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
cmake-build 文件不要传上来 |
src/net/callback_function.h
Outdated
@@ -35,8 +35,7 @@ concept HasSetFdFunction = requires(T t, uint64_t id, int8_t index) { | |||
{ (*t).GetConnId() } -> std::same_as<uint64_t>; // GetFd return type is int | |||
{ (*t).SetThreadIndex(index) } -> std::same_as<void>; // SetThreadIndex return type is void | |||
{ (*t).GetThreadIndex() } -> std::same_as<int8_t>; // GetThreadIndex return type is int8_t | |||
} | |||
|| std::is_class_v<T>; // If T is an ordinary class, the member function is called directly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这种没改动的,不要提交上来
48c0a03
to
3989b08
Compare
有文件冲突了,烦请处理下 |
src/cmd_admin.cc
Outdated
response += client->argv_[i]; | ||
} | ||
|
||
client->SetRes(CmdRes::kEcho, response); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里没必要使用 client->SetRes
返回数据,同理,上面也没必要在 CmdRet
中 新加一个类型,直接返回对应的数据就行
src/cmd_table_manager.cc
Outdated
@@ -56,6 +56,7 @@ void CmdTableManager::InitCmdTable() { | |||
ADD_SUBCOMMAND(Config, Get, -3); | |||
ADD_SUBCOMMAND(Config, Set, -4); | |||
ADD_COMMAND(Ping, 0); | |||
ADD_COMMAND(Echo, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里应该是 -1
具体可以参考redis
src/client.cc
Outdated
case kEcho: | ||
AppendStringRaw("+"); | ||
AppendStringRaw(content); | ||
AppendStringRaw(CRLF); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
调用 AppendSimpleString
I will carry out the subsequent work. |
This PR adds the functionality for the
echo
command to theadd_echo_cmd
branch. The command will return the arguments provided by the user as output.fix #19
Summary by CodeRabbit
New Features
Echo
that allows users to concatenate arguments and return a formatted response.kCmdNameEcho
to enhance command name definitions.Bug Fixes
Documentation
Echo
command that requires two parameters.