MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / enumerate

Method enumerate

src/storage/rocksdb.cpp:182–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180}
181
182bool RocksDBStorageProvider::enumerate(callback fn) const
183{
184 std::unique_ptr<rocksdb::Iterator> it = std::unique_ptr<rocksdb::Iterator>(m_spdb->NewIterator(ReadOptions(), m_spcolfamily.get()));
185 size_t count = 0;
186 for (it->SeekToFirst(); it->Valid(); it->Next()) {
187 if (FInternalKey(it->key().data(), it->key().size()))
188 continue;
189 ++count;
190 bool fContinue = fn(it->key().data()+HASHSLOT_PREFIX_BYTES, it->key().size()-HASHSLOT_PREFIX_BYTES, it->value().data(), it->value().size());
191 if (!fContinue)
192 break;
193 }
194 if (!it->Valid() && count != m_count)
195 {
196 if (const_cast<RocksDBStorageProvider*>(this)->m_count != count)
197 printf("WARNING: rocksdb count mismatch");
198 const_cast<RocksDBStorageProvider*>(this)->m_count = count;
199 }
200 assert(it->status().ok()); // Check for any errors found during the scan
201 return !it->Valid();
202}
203
204bool RocksDBStorageProvider::enumerate_hashslot(callback fn, unsigned int hashslot) const
205{

Callers 2

iterateMethod · 0.45

Calls 8

FInternalKeyFunction · 0.85
dataMethod · 0.80
valueMethod · 0.80
okMethod · 0.80
statusMethod · 0.80
getMethod · 0.45
keyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected