static */
| 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 | |
| 312 | template <typename FuncT, typename ReturnT, typename CleanupFuncT> |
| 313 | folly::coro::Task<ReturnT> FlashCacheComponent::onWorkerThread( |
nothing calls this directly
no test coverage detected