MCPcopy Create free account
hub / github.com/citp/BlockSci / BloomStore

Method BloomStore

tools/parser/bloom_filter.cpp:21–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19constexpr double Log2Squared = Log2 * Log2;
20
21BloomStore::BloomStore(const std::string &path_, int64_t length_) : bitMasks{}, backingFile(path_), length(length_) {
22
23 for (size_t i = 0; i < BloomStore::BlockSize; ++i) {
24 bitMasks.at(i) = BloomStore::BlockType{1} << i;
25 }
26
27 if (backingFile.size() == 0) {
28 backingFile.truncate(blockCount());
29 }
30
31 if (backingFile.size() != blockCount()) {
32 throw std::runtime_error("Trying to open bloom filter of wrong size");
33 }
34}
35
36int64_t BloomStore::blockCount() const {
37 return (length + BlockSize - 1) / BlockSize;

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.45
truncateMethod · 0.45

Tested by

no test coverage detected