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

Method ExecuteIntegerAggregate

src/brpc/redis_cluster.cpp:523–551  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

521}
522
523bool RedisClusterChannel::ExecuteIntegerAggregate(const ParsedCommand& cmd,
524 butil::IOBuf* encoded_reply,
525 Controller* cntl) {
526 if (cmd.args.size() < 2) {
527 AppendErrorReply(encoded_reply,
528 "ERR wrong number of arguments");
529 return true;
530 }
531
532 int64_t total = 0;
533 for (size_t i = 1; i < cmd.args.size(); ++i) {
534 std::vector<std::string> sub_args;
535 sub_args.push_back(cmd.args[0]);
536 sub_args.push_back(cmd.args[i]);
537
538 SingleCommandResult sub_result;
539 if (!ExecuteSingleCommand(sub_args, NULL, &sub_result, cntl)) {
540 return false;
541 }
542 if (sub_result.is_error) {
543 encoded_reply->swap(sub_result.encoded_reply);
544 return true;
545 }
546 total += sub_result.integer_value;
547 }
548
549 AppendIntegerReply(encoded_reply, total);
550 return true;
551}
552
553bool RedisClusterChannel::ExecuteEvalLike(const ParsedCommand& cmd,
554 butil::IOBuf* encoded_reply,

Callers

nothing calls this directly

Calls 3

sizeMethod · 0.45
push_backMethod · 0.45
swapMethod · 0.45

Tested by

no test coverage detected