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

Method allocateImpl

cachelib/navy/block_cache/BlockCache.cpp:1263–1276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1261}
1262
1263BlockCache::AllocData BlockCache::allocateImpl(const HashedKey& hk,
1264 const uint32_t valueSize,
1265 const uint16_t priority,
1266 const bool canWait) {
1267 uint32_t size = serializedSize(hk.key().size(), valueSize);
1268 auto [desc, addr, view] =
1269 allocator_.allocate(size, priority, canWait, hk.keyHash());
1270 if (desc.isReady()) {
1271 XDCHECK_LE(addr.offset() + size, regionManager_.regionSize());
1272 XDCHECK_EQ(size % allocAlignSize_, 0ULL)
1273 << fmt::format(" alignSize={}, size={}", allocAlignSize_, size);
1274 }
1275 return std::make_tuple(std::move(desc), size, std::move(addr), view);
1276}
1277
1278folly::Expected<BlockCache::AllocData, Status> BlockCache::allocateForInsert(
1279 const HashedKey& hk, const uint32_t valueSize, bool canWait) {

Callers

nothing calls this directly

Calls 7

regionSizeMethod · 0.80
sizeMethod · 0.45
keyMethod · 0.45
allocateMethod · 0.45
keyHashMethod · 0.45
isReadyMethod · 0.45
offsetMethod · 0.45

Tested by

no test coverage detected