MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / CreateChunkData

Method CreateChunkData

src/txgraph.cpp:892–913  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

890}
891
892void TxGraphImpl::CreateChunkData(GraphIndex idx, LinearizationIndex chunk_count) noexcept
893{
894 auto& entry = m_entries[idx];
895 // Make sure to not create chunk data for unlinked entries, which would make invoking
896 // m_fallback_order on them impossible.
897 Assume(entry.m_ref != nullptr);
898 if (!m_main_chunkindex_discarded.empty()) {
899 // Reuse an discarded node handle.
900 auto& node = m_main_chunkindex_discarded.back().value();
901 node.m_graph_index = idx;
902 node.m_chunk_count = chunk_count;
903 auto insert_result = m_main_chunkindex.insert(std::move(m_main_chunkindex_discarded.back()));
904 Assume(insert_result.inserted);
905 entry.m_main_chunkindex_iterator = insert_result.position;
906 m_main_chunkindex_discarded.pop_back();
907 } else {
908 // Construct a new entry.
909 auto emplace_result = m_main_chunkindex.emplace(idx, chunk_count);
910 Assume(emplace_result.second);
911 entry.m_main_chunkindex_iterator = emplace_result.first;
912 }
913}
914
915size_t GenericClusterImpl::TotalMemoryUsage() const noexcept
916{

Callers 1

UpdatedMethod · 0.80

Calls 6

emplaceMethod · 0.80
emptyMethod · 0.45
valueMethod · 0.45
backMethod · 0.45
insertMethod · 0.45
pop_backMethod · 0.45

Tested by

no test coverage detected