| 353 | } |
| 354 | |
| 355 | bool RedisClusterChannel::ExecuteCommand(const ParsedCommand& cmd, |
| 356 | butil::IOBuf* encoded_reply, |
| 357 | Controller* cntl) { |
| 358 | if (cmd.args.empty()) { |
| 359 | cntl->SetFailed(EREQUEST, "Empty redis command"); |
| 360 | return false; |
| 361 | } |
| 362 | const std::string& name = cmd.args[0]; |
| 363 | |
| 364 | if (name == "multi" || name == "exec") { |
| 365 | AppendErrorReply(encoded_reply, |
| 366 | "ERR MULTI/EXEC is not supported by RedisClusterChannel"); |
| 367 | return true; |
| 368 | } |
| 369 | if (name == "mget") { |
| 370 | return ExecuteMGet(cmd, encoded_reply, cntl); |
| 371 | } |
| 372 | if (name == "mset") { |
| 373 | return ExecuteMSet(cmd, encoded_reply, cntl); |
| 374 | } |
| 375 | if (name == "del" || name == "exists" || name == "unlink") { |
| 376 | return ExecuteIntegerAggregate(cmd, encoded_reply, cntl); |
| 377 | } |
| 378 | if (name == "eval" || name == "evalsha") { |
| 379 | return ExecuteEvalLike(cmd, encoded_reply, cntl); |
| 380 | } |
| 381 | |
| 382 | SingleCommandResult result; |
| 383 | if (!ExecuteSingleCommand(cmd.args, NULL, &result, cntl)) { |
| 384 | return false; |
| 385 | } |
| 386 | encoded_reply->swap(result.encoded_reply); |
| 387 | return true; |
| 388 | } |
| 389 | |
| 390 | bool RedisClusterChannel::ExecuteSingleCommand(const std::vector<std::string>& args, |
| 391 | const std::string* forced_endpoint, |