MCPcopy Create free account
hub / github.com/facebook/CacheLib / openForRead

Method openForRead

cachelib/navy/block_cache/Region.cpp:68–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68RegionDescriptor Region::openForRead() {
69 std::unique_lock l{lock_};
70 if (flags_ & kBlockAccess) {
71 // Region is currently in reclaim, retry later
72 if (isOnNavyThread()) {
73 // If we are on fiber, we can just sleep here
74 cond_.wait(l);
75 }
76 return RegionDescriptor{OpenStatus::Retry};
77 }
78 bool physReadMode = false;
79 if (isFlushedLocked() || !buffer_) {
80 physReadMode = true;
81 activePhysReaders_++;
82 } else {
83 activeInMemReaders_++;
84 }
85 return RegionDescriptor::makeReadDescriptor(OpenStatus::Ready, regionId_,
86 physReadMode);
87}
88
89std::unique_ptr<Buffer> Region::detachBuffer() {
90 std::unique_lock l{lock_};

Callers 7

lookupInternalMethod · 0.45
getRandomAllocMethod · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45

Calls 2

isOnNavyThreadFunction · 0.85
waitMethod · 0.45

Tested by 3

TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36