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

Method create

cachelib/interface/components/FlashCacheComponent.cpp:291–310  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

289}
290
291/* static */ Result<FlashCacheComponent> FlashCacheComponent::create(
292 std::string name,
293 navy::BlockCache::Config&& config,
294 std::unique_ptr<navy::Device> device,
295 const utils::CoroFiberAdapter::Config& executorConfig,
296 PersistenceConfig persistenceConfig) noexcept {
297 try {
298 if (auto result = initConfig(config, device.get(), persistenceConfig);
299 result.hasError()) {
300 return folly::makeUnexpected(std::move(result).error());
301 }
302 auto component = FlashCacheComponent(std::move(name), std::move(config),
303 std::move(device), executorConfig,
304 std::move(persistenceConfig));
305 component.tryRecover();
306 return component;
307 } catch (const std::invalid_argument& ia) {
308 return makeError(Error::Code::INVALID_CONFIG, ia.what());
309 }
310}
311
312template <typename FuncT, typename ReturnT, typename CleanupFuncT>
313folly::coro::Task<ReturnT> FlashCacheComponent::onWorkerThread(

Callers

nothing calls this directly

Calls 6

initConfigFunction · 0.85
whatMethod · 0.80
FlashCacheComponentClass · 0.70
getMethod · 0.45
tryRecoverMethod · 0.45

Tested by

no test coverage detected