MCPcopy Create free account
hub / github.com/Tencent/phxpaxos / GetInstanceValue

Method GetInstanceValue

src/node/pnode.cpp:719–756  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

717//////////////////////////////////////////////////////////////////////
718
719int PNode :: GetInstanceValue(const int iGroupIdx, const uint64_t llInstanceID,
720 std::vector<std::pair<std::string, int> > & vecValues)
721{
722 if (!CheckGroupID(iGroupIdx))
723 {
724 return Paxos_GroupIdxWrong;
725 }
726
727 string sValue;
728 int iSMID = 0;
729 int ret = m_vecGroupList[iGroupIdx]->GetInstance()->GetInstanceValue(llInstanceID, sValue, iSMID);
730 if (ret != 0)
731 {
732 return ret;
733 }
734
735 if (iSMID == BATCH_PROPOSE_SMID)
736 {
737 BatchPaxosValues oBatchValues;
738 bool bSucc = oBatchValues.ParseFromArray(sValue.data(), sValue.size());
739 if (!bSucc)
740 {
741 return Paxos_SystemError;
742 }
743
744 for (int i = 0; i < oBatchValues.values_size(); i++)
745 {
746 const PaxosValue & oValue = oBatchValues.values(i);
747 vecValues.push_back(make_pair(oValue.value(), oValue.smid()));
748 }
749 }
750 else
751 {
752 vecValues.push_back(make_pair(sValue, iSMID));
753 }
754
755 return 0;
756}
757
758//////////////////////////////////////////////////////////////////////////
759

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected