jamesge commented on a change in pull request #972: Redis server protocol
URL: https://github.com/apache/incubator-brpc/pull/972#discussion_r356954111
##########
File path: src/brpc/redis_command.h
##########
@@ -40,6 +40,28 @@ butil::Status RedisCommandByComponents(butil::IOBuf* buf,
const butil::StringPiece* components,
size_t num_components);
+// A parser used to parse redis raw command.
+class RedisCommandParser {
+public:
+ RedisCommandParser();
+
+ // Parse raw message from `buf'. Return PARSE_OK if successful.
+ ParseError Parse(butil::IOBuf& buf);
+
+ // After Parse returns PARSE_OK, call this function to swap
+ // the parsed command string to `out'.
+ void SwapCommandTo(std::string* out);
Review comment:
这种一次性的接口(只能swap一次)大概率是错误的设计。
就这个case,我觉得out应该是Parse的参数,且只会在返回PARSE_OK后被赋值。
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]