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

Method Run

test/brpc_redis_unittest.cpp:984–1007  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

982 , _batch_process(batch_process) {}
983
984 brpc::RedisCommandHandlerResult Run(brpc::RedisConnContext* ctx,
985 const std::vector<butil::StringPiece>& args,
986 brpc::RedisReply* output,
987 bool flush_batched) {
988 if (!ctx->session) {
989 output->SetError("ERR no auth");
990 return brpc::REDIS_CMD_HANDLED;
991 }
992 AuthSession* session = static_cast<AuthSession*>(ctx->session);
993 if (session->_password != _rs->_password) {
994 output->SetError("ERR no auth");
995 return brpc::REDIS_CMD_HANDLED;
996 }
997 if (args.size() < 2) {
998 output->SetError("ERR wrong number of arguments for 'get' command");
999 return brpc::REDIS_CMD_HANDLED;
1000 }
1001 if (_batch_process) {
1002 return _rs->OnBatched(args, output, flush_batched);
1003 } else {
1004 DoGet(args[1].as_string(), output);
1005 return brpc::REDIS_CMD_HANDLED;
1006 }
1007 }
1008
1009 void DoGet(const std::string& key, brpc::RedisReply* output) {
1010 auto it = m.find(key);

Callers

nothing calls this directly

Calls 4

OnBatchedMethod · 0.80
SetErrorMethod · 0.45
sizeMethod · 0.45
as_stringMethod · 0.45

Tested by

no test coverage detected