MCPcopy Create free account
hub / github.com/apple/foundationdb / clear_impl

Method clear_impl

fdbserver/VersionedBTree.actor.cpp:2048–2066  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2046
2047 // Clears the cache, saving the entries to second cache, then waits for each item to be evictable and evicts it.
2048 ACTOR static Future<Void> clear_impl(ObjectCache* self, bool waitForSafeEviction) {
2049 // Claim ownership of all of our cached items, removing them from the evictor's control and quota.
2050 for (auto& ie : self->cache) {
2051 self->pEvictor->reclaim(ie.second);
2052 }
2053
2054 // All items are in the cache so we don't need the prioritized eviction order anymore, and the cache is about
2055 // to be destroyed so the prioritizedEvictions head/tail will become invalid.
2056 self->prioritizedEvictions.clear();
2057
2058 state typename CacheT::iterator i = self->cache.begin();
2059 while (i != self->cache.end()) {
2060 wait(waitForSafeEviction ? i->second.item.onEvictable() : i->second.item.cancel());
2061 ++i;
2062 }
2063 self->cache.clear();
2064
2065 return Void();
2066 }
2067
2068 Future<Void> clear(bool waitForSafeEviction = false) { return clear_impl(this, waitForSafeEviction); }
2069

Callers

nothing calls this directly

Calls 7

reclaimMethod · 0.80
onEvictableMethod · 0.80
clearMethod · 0.65
cancelMethod · 0.65
VoidClass · 0.50
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected