MCPcopy Create free account
hub / github.com/ElementsProject/elements / ReadAtCursor

Method ReadAtCursor

src/wallet/bdb.cpp:666–690  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

664}
665
666bool BerkeleyBatch::ReadAtCursor(CDataStream& ssKey, CDataStream& ssValue, bool& complete)
667{
668 complete = false;
669 if (m_cursor == nullptr) return false;
670 // Read at cursor
671 SafeDbt datKey;
672 SafeDbt datValue;
673 int ret = m_cursor->get(datKey, datValue, DB_NEXT);
674 if (ret == DB_NOTFOUND) {
675 complete = true;
676 }
677 if (ret != 0)
678 return false;
679 else if (datKey.get_data() == nullptr || datValue.get_data() == nullptr)
680 return false;
681
682 // Convert to streams
683 ssKey.SetType(SER_DISK);
684 ssKey.clear();
685 ssKey.write({BytePtr(datKey.get_data()), datKey.get_size()});
686 ssValue.SetType(SER_DISK);
687 ssValue.clear();
688 ssValue.write({BytePtr(datValue.get_data()), datValue.get_size()});
689 return true;
690}
691
692void BerkeleyBatch::CloseCursor()
693{

Callers 4

RewriteMethod · 0.45
LoadWalletMethod · 0.45
FindWalletTxMethod · 0.45
DumpWalletFunction · 0.45

Calls 7

BytePtrFunction · 0.85
get_dataMethod · 0.80
get_sizeMethod · 0.80
getMethod · 0.45
SetTypeMethod · 0.45
clearMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected