MCPcopy Create free account
hub / github.com/Tencent/phxqueue / Get

Method Get

phxqueue/store/store.cpp:537–578  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

535}
536
537comm::RetCode Store::Get(const comm::proto::GetRequest &req, comm::proto::GetResponse &resp) {
538 QLVerb("Get");
539
540 comm::StoreBP::GetThreadInstance()->OnGet(req);
541
542 comm::RetCode ret;
543
544 if (comm::RetCode::RET_OK != (ret = CheckGetRequest(req))) {
545 comm::StoreBP::GetThreadInstance()->OnGetRequestInvalid(req);
546 QLErr("CheckGetRequest ret %d", as_integer(ret));
547 return ret;
548 }
549
550 int paxos_group_id{req.queue_id() % impl_->opt.ngroup};
551 if (comm::RetCode::RET_OK !=
552 (ret = CheckMaster(paxos_group_id, *resp.mutable_redirect_addr()))) {
553 comm::StoreBP::GetThreadInstance()->OnGetCheckMasterUnpass(req);
554 if (as_integer(ret) < 0) {
555 QLErr("CheckMaster ret %d paxos_group_id %d", as_integer(ret), paxos_group_id);
556 }
557 return ret;
558 }
559 comm::StoreBP::GetThreadInstance()->OnGetCheckMasterPass(req);
560
561 comm::StoreBP::GetThreadInstance()->OnBaseMgrGet(req);
562 if (comm::RetCode::RET_OK != (ret = impl_->basemgr->Get(req, resp))) {
563 comm::StoreBP::GetThreadInstance()->OnBaseMgrGetFail(req);
564 QLErr("basemgr Get ret %d", as_integer(ret));
565 return ret;
566 }
567 comm::StoreBP::GetThreadInstance()->OnBaseMgrGetSucc(req, resp);
568
569 QLVerb("Get Succ. "
570 "req: topic_id %d store_id %d queue_id %d limit %d atime %" PRIu64
571 " sub_id %d prev_cursor_id %" PRIu64 " next_cursor_id %" PRIu64 ". "
572 "resp: items.size() %d prev_cursor_id %" PRIu64 " next_cursor_id %" PRIu64,
573 req.topic_id(), req.store_id(), req.queue_id(), req.limit(),
574 req.atime(), req.sub_id(), req.prev_cursor_id(), req.next_cursor_id(),
575 resp.items_size(), resp.prev_cursor_id(), resp.next_cursor_id());
576
577 return comm::RetCode::RET_OK;
578}
579
580bool Store::SkipGet(const comm::proto::QItem &item, const comm::proto::GetRequest &req) {
581 comm::RetCode ret;

Callers 1

PrepareWaitMethod · 0.45

Calls 8

as_integerFunction · 0.85
OnGetRequestInvalidMethod · 0.80
OnGetCheckMasterPassMethod · 0.80
OnBaseMgrGetMethod · 0.80
OnBaseMgrGetFailMethod · 0.80
OnBaseMgrGetSuccMethod · 0.80
OnGetMethod · 0.45

Tested by

no test coverage detected