MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / leafBlockCount

Method leafBlockCount

source/core/StarBTreeDatabase.cpp:262–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260}
261
262uint32_t BTreeDatabase::leafBlockCount() {
263 WriteLocker writeLocker(m_lock);
264 checkIfOpen("leafBlockCount", true);
265
266 struct LeafBlocksVisitor {
267 bool operator()(shared_ptr<IndexNode> const&) {
268 return true;
269 }
270
271 bool operator()(shared_ptr<LeafNode> const& leaf) {
272 leafBlockCount += 1 + parent->leafTailBlocks(leaf->self).size();
273 return true;
274 }
275
276 BTreeDatabase* parent = nullptr;
277 BlockIndex leafBlockCount = 0;
278 };
279
280 LeafBlocksVisitor visitor;
281 visitor.parent = this;
282 m_impl.forAllNodes(visitor);
283
284 return visitor.leafBlockCount;
285}
286
287void BTreeDatabase::commit() {
288 WriteLocker writeLocker(m_lock);

Callers 2

testBTreeDatabaseFunction · 0.80
TESTFunction · 0.80

Calls 1

forAllNodesMethod · 0.80

Tested by 2

testBTreeDatabaseFunction · 0.64
TESTFunction · 0.64