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

Method GetInstanceValue

src/algorithm/instance.cpp:854–879  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

852//////////////////////////////////////////
853
854int Instance :: GetInstanceValue(const uint64_t llInstanceID, std::string & sValue, int & iSMID)
855{
856 iSMID = 0;
857
858 if (llInstanceID >= m_oAcceptor.GetInstanceID())
859 {
860 return Paxos_GetInstanceValue_Value_Not_Chosen_Yet;
861 }
862
863 AcceptorStateData oState;
864 int ret = m_oPaxosLog.ReadState(m_poConfig->GetMyGroupIdx(), llInstanceID, oState);
865 if (ret != 0 && ret != 1)
866 {
867 return -1;
868 }
869
870 if (ret == 1)
871 {
872 return Paxos_GetInstanceValue_Value_NotExist;
873 }
874
875 memcpy(&iSMID, oState.acceptedvalue().data(), sizeof(int));
876 sValue = string(oState.acceptedvalue().data() + sizeof(int), oState.acceptedvalue().size() - sizeof(int));
877
878 return 0;
879}
880
881}
882

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected