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

Method EstimateSize

src/dbwrapper.h:307–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

305
306 template<typename K>
307 size_t EstimateSize(const K& key_begin, const K& key_end) const
308 {
309 CDataStream ssKey1(SER_DISK, CLIENT_VERSION), ssKey2(SER_DISK, CLIENT_VERSION);
310 ssKey1.reserve(DBWRAPPER_PREALLOC_KEY_SIZE);
311 ssKey2.reserve(DBWRAPPER_PREALLOC_KEY_SIZE);
312 ssKey1 << key_begin;
313 ssKey2 << key_end;
314 leveldb::Slice slKey1((const char*)ssKey1.data(), ssKey1.size());
315 leveldb::Slice slKey2((const char*)ssKey2.data(), ssKey2.size());
316 uint64_t size = 0;
317 leveldb::Range range(slKey1, slKey2);
318 pdb->GetApproximateSizes(&range, 1, &size);
319 return size;
320 }
321
322 /**
323 * Compact a certain range of keys in the database.

Callers

nothing calls this directly

Calls 4

reserveMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
GetApproximateSizesMethod · 0.45

Tested by

no test coverage detected