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

Method SendBuffer

src/algorithm/checkpoint_sender.cpp:297–334  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

295}
296
297int CheckpointSender :: SendBuffer(const int iSMID, const uint64_t llCheckpointInstanceID,
298 const std::string & sFilePath, const uint64_t llOffset, const std::string & sBuffer)
299{
300 uint32_t iChecksum = crc32(0, (const uint8_t *)sBuffer.data(), sBuffer.size(), CRC32SKIP);
301
302 int ret = 0;
303 while (true)
304 {
305 if (m_bIsEnd)
306 {
307 return -1;
308 }
309
310 if (!CheckAck(m_llSequence))
311 {
312 return -1;
313 }
314
315 ret = m_poLearner->SendCheckpoint(
316 m_iSendNodeID, m_llUUID, m_llSequence, llCheckpointInstanceID,
317 iChecksum, sFilePath, iSMID, llOffset, sBuffer);
318
319 BP->GetCheckpointBP()->SendCheckpointOneBlock();
320
321 if (ret == 0)
322 {
323 m_llSequence++;
324 break;
325 }
326 else
327 {
328 PLGErr("SendCheckpoint fail, ret %d need sleep 30s", ret);
329 Time::MsSleep(30000);
330 }
331 }
332
333 return ret;
334}
335
336void CheckpointSender :: Ack(const nodeid_t iSendNodeID, const uint64_t llUUID, const uint64_t llSequence)
337{

Callers

nothing calls this directly

Calls 3

crc32Function · 0.85
sizeMethod · 0.80

Tested by

no test coverage detected