MCPcopy Create free account
hub / github.com/apache/brpc / EncodeReply

Function EncodeReply

src/brpc/redis_cluster.cpp:124–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122}
123
124static bool EncodeReply(const RedisReply& reply, butil::IOBuf* out) {
125 butil::IOBufAppender appender;
126 // RedisReply::SerializeTo does not support REDIS_REPLY_NIL directly.
127 // Encode nil as a null bulk string so response parsing can consume it.
128 if (reply.type() == REDIS_REPLY_NIL) {
129 appender.append("$-1\r\n", 5);
130 appender.move_to(*out);
131 return true;
132 }
133 if (!const_cast<RedisReply&>(reply).SerializeTo(&appender)) {
134 return false;
135 }
136 appender.move_to(*out);
137 return true;
138}
139
140} // namespace
141

Callers 1

SendToEndpointMethod · 0.85

Calls 4

typeMethod · 0.45
appendMethod · 0.45
move_toMethod · 0.45
SerializeToMethod · 0.45

Tested by

no test coverage detected