jamesge commented on a change in pull request #972: Redis server protocol
URL: https://github.com/apache/incubator-brpc/pull/972#discussion_r358591542
##########
File path: src/brpc/redis_reply.cpp
##########
@@ -352,4 +413,52 @@ void RedisReply::CopyFromDifferentArena(const RedisReply&
other,
}
}
+bool RedisReply::SetArray(int size) {
+ if (!_arena || _type != REDIS_REPLY_NIL) {
+ return false;
+ }
+ _type = REDIS_REPLY_ARRAY;
+ if (size < 0) {
+ LOG(ERROR) << "negative size=" << size << " when calling SetArray";
+ return false;
+ } else if (size == 0) {
+ _length = 0;
+ return true;
+ }
+ RedisReply* subs = (RedisReply*)_arena->allocate(sizeof(RedisReply) *
size);
+ if (!subs) {
+ LOG(FATAL) << "Fail to allocate RedisReply[" << size << "]";
+ return false;
+ }
+ for (int i = 0; i < size; ++i) {
+ new (&subs[i]) RedisReply(_arena);
+ }
+ _length = size;
+ _data.array.replies = subs;
+ return true;
+}
+
+bool RedisReply::SetBasicString(const std::string& str, RedisReplyType type) {
Review comment:
redis语境下有BasicString这个东西吗?叫SetStringImpl就行了
----------------------------------------------------------------
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]