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

Method GetCurrent

phxqueue/lock/lockdb.cpp:501–530  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

499}
500
501comm::RetCode LockDb::GetCurrent(string &k, proto::LocalLockInfo &v) {
502 if (Type::MAP == type_) {
503 k = map_it_->first;
504 v = map_it_->second;
505 } else if (Type::LEVELDB == type_) {
506 string vstr;
507 comm::RetCode ret{GetCurrent(k, vstr)};
508 if (comm::RetCode::RET_OK != ret) {
509 QLErr("key \"%s\" get value err", k.c_str());
510
511 return ret;
512 }
513
514 if (0u == k.find(KEY_IGNORE_PREFIX)) {
515 // reserve key
516 return comm::RetCode::RET_ERR_IGNORE;
517 }
518
519 bool succ{v.ParseFromString(vstr)};
520 if (!succ) {
521 QLErr("ParseFromString key \"%s\" value \"%s\" err", k.c_str(), vstr.c_str());
522
523 return comm::RetCode::RET_ERR_LOGIC;
524 }
525 } else {
526 return comm::RetCode::RET_ERR_NO_IMPL;
527 }
528
529 return comm::RetCode::RET_OK;
530}
531
532comm::RetCode LockDb::GetCurrent(string &k, string &vstr) {
533 if (Type::LEVELDB == type_) {

Callers 1

InitMethod · 0.80

Calls 1

ToStringMethod · 0.80

Tested by

no test coverage detected